TAILIEUCHUNG - Mapping Tables and Columns

Mapping Tables and Columns In Chapter 3, "Introduction to Structured Query Language (SQL)," you learned that the AS keyword is used to specify an alias for a table or column. | Mapping Tables and Columns In Chapter 3 Introduction to Structured Query Language SQL you learned that the AS keyword is used to specify an alias for a table or column. The following example uses the AS keyword to alias the CustomerlD column as MyCustomer and also alias the Customers table as Cust SELECT CustomerlD AS MyCustomer CompanyName Address FROM Customers AS Cust WHERE CustomerlD ALFKI Figure shows the results of this SELECT statement. Figure Using the AS keyword The following code uses this SELECT statement to populate a DataSet object named myDataSet SqlCommand mySqlCommand SELECT CustomerlD AS MyCustomer CompanyName Address FROM Customers AS Cust WHERE CustomerlD ALFKI SqlDataAdapter mySqlDataAdapter new SqlDataAdapter mySqlCommand DataSet myDataSet new DataSet myDataSet Customers Notice the Fill method specifies the name of the DataTable as Customers which is known as the source DataTable name. To map a DataTable in your DataSet you create an object of the DataTableMapping class using the Add method this class belongs to the namespace which you should import into your program. The following example creates a DataTableMapping object named myDataTableMapping passing Customers and Cust to the Add method DataTableMapping myDataTableMapping Customers Cust Notice that the Add method is called through the TableMappings property. The TableMappings property returns an object of the TableMappingCollection class. This object is a collection of TableMapping objects and you use a TableMapping object to map the source name to a different DataTable name therefore the previous example maps the source name of Customers to Cust. You can read this mapping using the SourceTable and DataSetTable properties of myDataTableMapping. For example .

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.