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

ASP.NET
Asp.Net使用POST方法最简单的实现
实现.NET应用程序的自动更新
优秀ASP.NET程序员修炼之路
ASP.NET中实现模板页
在ASP.Net 2.0中实现多语言界面的方法
小议优化ASP.NET应用性能之Cache篇
.net开发投票机的思路
浅析CMS内容管理系统的两种方案
ASP.NET 2.0中动态修改页面标题
“您无权查看该网页”的原因和解决方法
将一个图片按比例缩放显示在一个Frame中
编程使用资源文件实现多语言页面(In Action)
.Net编程的多个小技巧
asp.net2.0学习历程-菜鸟到中级程序员的飞跃
asp.net如何连接sql server2000数据库
FCKeditor 2.6在ASP.NET中的配置方法
使用ASP.NET开发移动通讯的几种方法
ASP.NET 2.0的URL映射的实现方法
如何在Asp.net中使用HtmlArea编辑器
ASP.NET 2.0 中实现跨页提交

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


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


using System;
using System.Data;
using System.Data.OleDb;
using System.Collections;

namespace XLang.VideoOnline.Framework.Database.Access
{
///
/// Summary description for ACCESS_DataViewsCollection.
///

public class DataViewsCollection
{
private Database.Access.DataView[] _views;
private int _count;
public int Count
{
get
{
return _count;
}
}

public DataViewsCollection(OleDbConnection connection)
{
System.Data.DataTable schemaTable = connection.GetOleDbSchemaTable(OleDbSchemaGuid.Tables,
new object[] {null, null,null, "VIEW"});
_count=schemaTable.Rows.Count;
_views=new Database.Access.DataView[_count];
for(int i=0;i<_count;i++)
{
_views[i]=new Database.Access.DataView(schemaTable.Rows[i][2].ToString());
}
}

public Database.Access.DataView this [int tableIndex]

{
get
{
return _views[tableIndex];
}
set
{
_views[tableIndex]=value;
}
}

public Database.Access.DataView this [string viewName]
{
get
{
return this [NameToIndex(viewName)];
}
set
{
this [NameToIndex(viewName)]=value;
}
}

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