Access database Accessibility Component (IV)

Source: Internet
Author: User
Tags count access database
access| Access | data | database using System;
Using System.Data;
Using System.Data.OleDb;
Using System.Collections;


Namespace XLang.VideoOnline.Framework.Database.Access
{
<summary>
Summary description for Access_dataviewscollection.
</summary>
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;
}



}
}





Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.