TAILIEUCHUNG - Executing SELECT Statements and TableDirect Commands phần 2

Listing : /* illustrates how to read a table schema */ using System; using ; using System | illustrates how to read a table schema using System using using class SchemaOnlyCommandBehavior public static void Main SqlConnection mySqlConnection new SqlConnection server localhost database Northwind uid sa pwd sa SqlCommand mySqlCommand SELECT ProductID ProductName UnitPrice FROM Products WHERE ProductID 1 pass the constant to the ExecuteReader method to get the schema SqlDataReader productsSqlDataReader read the DataTable containing the schema from the DataReader DataTable myDataTable display the rows and columns in the DataTable foreach DataRow myDataRow in nNew column details follow foreach DataColumn myDataColumn in myDataColumn myDataRow myDataColumn if ProviderType myDataColumn myDataRow myDataColumn You should notice the different details for the ProductID ProductName and UnitPrice columns in the output that follows New column details follow ColumnName ProductID ColumnOrdinal 0 ColumnSize 4 NumericPrecision 0 NumericScale 0 IsUnique IsKey BaseCatalogName BaseColumnName ProductID BaseSchemaName BaseTableName DataType AllowDBNull False ProviderType 8 ProviderType Int IsAliased IsExpression IsIdentity True IsAutoIncrement True IsRowVersion IsHidden IsLong False IsReadOnly True New column details follow ColumnName ProductName ColumnOrdinal 1 ColumnSize 40 NumericPrecision 0 NumericScale 0 IsUnique IsKey BaseCatalogName BaseColumnName ProductName BaseSchemaName BaseTableName DataType AllowDBNull False ProviderType 12 ProviderType .

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.