TAILIEUCHUNG - Retrieving Database Schema Information from SQL Server

[ Team LiB ] Recipe Retrieving Database Schema Information from SQL Server Problem You need to retrieve database schema information from a SQL Server database. | Team LiB Recipe Retrieving Database Schema Information from SQL Server Problem You need to retrieve database schema information from a SQL Server database. Solution Retrieve table schema information using either information schema views or the OLE DB .NET data provider Connection object. The sample code retrieves a list of tables in the Northwind sample database. The C code is shown in Example 10-2. Example 10-2. File Namespaces variables and constants using System using using using using . . . DataTable schemaTable if String getSchemaTableText SELECT FROM WHERE TABLE_TYPE BASE TABLE ORDER BY TABLE_TYPE Retrieve the schema table contents. SqlDataAdapter da new SqlDataAdapter getSchemaTableText S ql_ConnectString schemaTable new DataTable schemaTable SQL Server .NET Provider else OleDbConnection conn new OleDbConnection OleDb_ConnectString Get the schema table. schemaTable new object null null null TABLE OLE DB .NET Provider Bind the default view of schema table to the grid. Discussion The first solution uses information schema views that are available in SQL Server and later. These views provide system-table independent access to SQL Server metadata. Although based on the sysobjects and syscomments system tables the views allow applications to continue to work properly even if the system tables change. They provide an alternative to the system stored procedures that were previously used and are still available. The INFORMATION_SCHEMA views conform to the SQL-92 Standard. The views are defined within each database in a schema named INFORMATION_SCHEMA. To access .

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.