tailieunhanh - 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 .

TÀI LIỆU LIÊN QUAN
10    127    1
6    150    1
7    127    1
5    125    1
6    127    1
6    115    1
6    122    1
6    174    1
7    122    1
5    97    1
crossorigin="anonymous">
Đã 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.