TAILIEUCHUNG - Listing Tables in an Access Database

[ Team LiB ] Recipe Listing Tables in an Access Database Problem You need a list of all tables in your Access database. Solution Use the GetOLEDBSchemaTable | Team LiB Recipe 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 select adodb from the .NET tab in Visual Studio .NET s Add Reference Dialog. You ll also need a reference to Microsoft ADO Ext. 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 Namespaces variables and constants using System using using using using . . . OLE DB StringBuilder result new StringBuilder Open the OLE DB connection. OleDbConnection conn new OleDbConnection MsAccess_ConnectString Retrieve schema information for all tables. DataTable schemaTable new object null null null TABLE TABLE Iterate over the collection of table records. foreach DataRow row in row TABLE_NAME ADOX StringBuilder result new StringBuilder Open the connection. conn new MsAccess_ConnectString 0 Create an ADOX catalog object for the connecton. cat new conn TABLE tKEY .

TÀI LIỆU MỚI ĐĂNG
2    139    0    03-07-2024
TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.