Đang chuẩn bị liên kết để tải về tài liệu:
Professional Microsoft Smartphone Programming phần 4

Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ

Hình 14-13 trình bày cách bố trí đồ họa giao diện người dùng và các mục trình đơn. Nếu bạn kiểm tra các mã được tạo ra bởi Visual Studio 2005 trongKhi ném một ngoại lệ do người dùng định nghĩa, bạn có tùy chọn để sử dụng một trong những nhà xây dựng sẵn. | Data Access with SQL Server Mobile Integrated Security SSPI Inital Catalog myCourses dbConn.Open SqlCommand sqlCmd dbConn.CreateCommand sqlCmd.CommandText SELECT studentID lastName FROM students sqlDataReader stuReader sqlCmd.ExecuteReader while stuReader.Read Console.WriteLine 0 t 1 stuReader.GetInt32 0 stuReader.GetString l stuReader.Close dbConn.Close In the preceding code a SQL connection is first created by specifying the connection string and invoking the Open method of the SqlConnection class. Then a SqlCommand object is instantiated to retrieve records in the studentID field and the lastName field from the table students. The results of the query are executed by the ExecuteReader method of the SqlCommand class and are passed to a sqlDataReader object. By iterating the sqlDataReader object with the Read method data can be retrieved row by row. To retrieve the data in disconnected mode a typical approach is to use a DataAdapater object to retrieve data from a data source and then populate the data to a DataSet object which can hold multiple data tables in memory. The following code snippet demonstrates how to perform the same function in disconnected mode using System using System.Data using System.Data.SqlClient . SqlConnection dbConn new SqlConnection Data Source localhost Integrated Security SSPI Inital Catalog myCourses string qStr SELECT studentID lastName FROM students SqlDataAdapter stuAdapter new SqlDataAdapter qStr dbConn DataSet stuSet new DataSet stuAdapter.Fill stuSet students for int i 0 i stuSet.Tables students .Rows.Count-1 i int ID System.Convert.ToInt32 stuSet.Tables students .Rows i studentID string name stuSet.Tables students .Rows i lastName .ToString System.Console.WriteLine 0 t 1 ID name In the preceding example a SqlConnection object is first created. However you do not need to maintain an open connection to the database by calling the open method. Rather a sqlDataApapter object is 133 Chapter 6 created with the same SQL query command .

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.