Siêu thị PDFTải ngay đi em, trời tối mất

Thư viện tri thức trực tuyến

Kho tài liệu với 50,000+ tài liệu học thuật

© 2023 Siêu thị PDF - Kho tài liệu học thuật hàng đầu Việt Nam

Tài liệu Listing Tables in an Access Database ppt
MIỄN PHÍ
Số trang
3
Kích thước
14.1 KB
Định dạng
PDF
Lượt xem
1548

Tài liệu Listing Tables in an Access Database ppt

Nội dung xem thử

Mô tả chi tiết

[ Team LiB ]

Recipe 10.14 Listing Tables in an Access Database

Problem

You need a list of all tables in your Access database.

Solution

Use the GetOLEDBSchemaTable( ) method of the OleDbConnection class or use ADOX

through COM interop.

The first technique uses the GetOLEDBSchemaTable( ) method to return schema

information about user tables. These results are then displayed.

For the second technique, you'll need a reference to the Primary Interop Assembly (PIA)

for ADO provided in the file ADODB.DLL; select adodb from the .NET tab in Visual

Studio .NET's Add Reference Dialog. You'll also need a reference to Microsoft ADO

Ext. 2.7 for DDL and Security from the COM tab in Visual Studio .NET's Add Reference

Dialog.

The second technique creates an ADOX Catalog object through COM interop. The

Tables property of this object accesses the collection of tables from which the name and

other information are displayed.

The C# code is shown in Example 10-14.

Example 10-14. File: ListAccessTablesForm.cs

// Namespaces, variables, and constants

using System;

using System.Configuration;

using System.Text;

using System.Data;

using System.Data.OleDb;

// . . .

// OLE DB

StringBuilder result = new StringBuilder( );

// Open the OLE DB connection.

Tải ngay đi em, còn do dự, trời tối mất!