欢迎光临
我们一直在努力

ACCESS数据库访问组件(三)-.NET教程,数据库应用

建站超值云服务器,限时71元/月

using system;

using system.data;

using system.data.oledb;

using system.collections;

namespace xlang.videoonline.framework.database.access

{

/// <summary>

/// summary description for access_datatablescollection.

/// </summary>

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;

}

}

}

赞(0)
版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com 特别注意:本站所有转载文章言论不代表本站观点! 本站所提供的图片等素材,版权归原作者所有,如需使用,请与原作者联系。未经允许不得转载:IDC资讯中心 » ACCESS数据库访问组件(三)-.NET教程,数据库应用
分享到: 更多 (0)

相关推荐

  • 暂无文章