TAILIEUCHUNG - Retrieve Data by Using the DataReader Object

3,1 Lấy dữ liệu khi sử dụng các đối tượng DataReader Trong chương 1, bạn đã học cách sử dụng các điều khiển ràng buộc với OleDb điều khiển có thể được bao gồm trong các hình thức. Một số nhà phát triển thích sử dụng điều khiển Chưa cam kết thực hiện nhiệm vụ cùng | Retrieve Data by Using the DataReader Object In Chapter 1 you learned how to use bound controls to OleDb controls that could be included on the forms. Some developers prefer to use unbound controls to perform the same task. The DataReader object allows you to add items to a list box in a more efficient manner because it is only a read-and-forward-only type object. This How-To tells you how to generate a limited ListBox control by using a DataReader object. You want to create a limited list of customers. You don t want to use bound controls because you are a cool VB developer who knows better than that. You heard that the DataReader object is a fast way to get data. How do you retrieve data using the DataReader object to perform this task Technique For this How-To you will be using the ListBox control and loading items into it by using the DataReader object. To get to the DataReader object you need to look at the Command object. The Command object in .NET works similarly to the ADO Command in that you will assign the stored procedure name or SQL statement to the CommandText property as well as the connection to use. One difference is that you will use the Open method of the Command object and then the ExecuteReader method to create the DataReader object. You will then use the Read method off of the DataReader object to perform two tasks. The first task is that when used in a loop you can test for to check whether to terminate the loop and also to iterate through the rows that the DataReader object returns. After you have the DataReader populated and you are iterating through the rows you will load the data into the ListBox control. You will be using the Clear and Add methods which were used in VB 6. In addition you will use the BeginEdit and EndEdit methods which speed up loading ListBox controls when you are loading a large amount of data. To view this example in design view open the form called in the chapter s solution. Steps .

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.