当前位置: 首页 > 图文教程 > 网络编程 > ASP.NET > ACCESS数据库访问组件(三)

ASP.NET
many-to-many多对多映射
.NETRemotingChannelListener
转载李建忠老师的一篇文章
原创ColorComboBox控件
用IDisposable接口释放.NET资源
c#v2.0 扩展特性 翻译1
XPath中如何比较不同类型的对象
用哈希表搜索对象
C#陷阱int i = 10; i += i++; i =
Make a window that pops up from taskbar
获取网站返回的头部信息
自己动手写屏保
在DataGrid中添加Radio单选按钮列
实现性能目标的几种方法
增强.NETFramework中线程的功能
ASP.NET 2.0,写无限级下拉菜单不再难
book_dotnet
用.NET武装你的头脑
准备你的发布阶段
移植到.NET

ASP.NET 中的 ACCESS数据库访问组件(三)


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-11-03   浏览: 41 ::
收藏到网摘: n/a


using System;
using System.Data;
using System.Data.OleDb;
using System.Collections;
namespace XLang.VideoOnline.Framework.Database.Access
{
///
/// Summary description for ACCESS_DataTablesCollection.
///

public class DataTablesCollection
{
private Database.Access.DataTable[] _tables;
private int _count;
public int Count
{
get
{
return _count;
}
}

public DataTablesCollection(OleDbConnection connection)
{
System.Data.DataTable schemaTable = connection.GetOleDbSchemaTable(OleDbSchemaGuid.Tables,
new object[] {null, null, null, "TABLE"});
_count=schemaTable.Rows.Count+1;
_tables=new Database.Access.DataTable[_count];
for(int i=0;i<_count-1;i++)
{
_tables[i]=new Database.Access.DataTable(schemaTable.Rows[i][2].ToString());
}
_tables[_count-1]=new Database.Access.DataTable("temp");

}
public Database.Access.DataTable this [int tableIndex]
{
get
{
return _tables[tableIndex];
//return this[tableIndex];
}
set
{
_tables[tableIndex]=value;
//this[tableIndex]=value;
}
}

public Database.Access.DataTable this [string tableName]
{
get
{
return this [NameToIndex(tableName)];
//return this[tableName];
}
set
{
this [NameToIndex(tableName)]=value;
//this[tableName]=value;
}
}

private int NameToIndex(string tableName)
{
for(int i=0;i<_tables.Length;i++)
{
if(_tables[i].Name.ToUpper()==tableName.ToUpper())
return i;
}
return -1; } }}