Kinh doanh - Marketing
Kinh tế quản lý
Biểu mẫu - Văn bản
Tài chính - Ngân hàng
Công nghệ thông tin
Tiếng anh ngoại ngữ
Kĩ thuật công nghệ
Khoa học tự nhiên
Khoa học xã hội
Văn hóa nghệ thuật
Sức khỏe - Y tế
Văn bản luật
Nông Lâm Ngư
Kỹ năng mềm
Luận văn - Báo cáo
Giải trí - Thư giãn
Tài liệu phổ thông
Văn mẫu
Giới thiệu
Đăng ký
Đăng nhập
Tìm
Danh mục
Kinh doanh - Marketing
Kinh tế quản lý
Biểu mẫu - Văn bản
Tài chính - Ngân hàng
Công nghệ thông tin
Tiếng anh ngoại ngữ
Kĩ thuật công nghệ
Khoa học tự nhiên
Khoa học xã hội
Văn hóa nghệ thuật
Y tế sức khỏe
Văn bản luật
Nông lâm ngư
Kĩ năng mềm
Luận văn - Báo cáo
Giải trí - Thư giãn
Tài liệu phổ thông
Văn mẫu
Thông tin
Điều khoản sử dụng
Quy định bảo mật
Quy chế hoạt động
Chính sách bản quyền
Giới thiệu
Đăng ký
Đăng nhập
0
Trang chủ
Công Nghệ Thông Tin
Kỹ thuật lập trình
Executing SELECT Statements and TableDirect Commands phần 2
Đang chuẩn bị liên kết để tải về tài liệu:
Executing SELECT Statements and TableDirect Commands phần 2
Thanh Thủy
49
11
pdf
Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ
Tải xuống
Listing 8.3: SCHEMAONLYCOMMANDBEHAVIOR.CS /* SchemaOnlyCommandBehavior.cs illustrates how to read a table schema */ using System; using System.Data; using System | Listing_8.3 _SCHEMAONLYCOMMANDBEHAVIOR.CS_ SchemaOnlyCommandBehavior.es illustrates how to read a table schema using System using System.Data using System.Data.SqlClient class SchemaOnlyCommandBehavior public static void Main SqlConnection mySqlConnection new SqlConnection server localhost database Northwind uid sa pwd sa SqlCommand mySqlCommand mySqlConnection.CreateCommand mySqlCommand.CommandText SELECT ProductID ProductName UnitPrice FROM Products WHERE ProductID 1 mySqlConnection.Open pass the CommandBehavior.SchemaOnly constant to the ExecuteReader method to get the schema SqlDataReader productsSqlDataReader mySqlCommand.ExecuteReader CommandBehavior.SchemaOnly read the DataTable containing the schema from the DataReader DataTable myDataTable productsSqlDataReader.GetSchemaTable display the rows and columns in the DataTable foreach DataRow myDataRow in myDataTable.Rows Console.WriteLine nNew column details follow foreach DataColumn myDataColumn in myDataTable.Columns Console.WriteLine myDataColumn myDataRow myDataColumn if myDataColumn.ToString ProviderType Console.WriteLine myDataColumn System.Data.SqlDbType myDataRow myDataColumn productsSqlDataReader.Close mySqlConnection.Close 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 System.Int32 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 System.String AllowDBNull False ProviderType 12 ProviderType .
TÀI LIỆU LIÊN QUAN
Executing SELECT Statements and TableDirect Commands phần 1
Executing SELECT Statements and TableDirect Commands phần 2
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.