TAILIEUCHUNG - Using a DataReader Object in Visual Studio .NET

Using a DataReader Object in Visual Studio .NET You can't visually create a DataReader object in Visual Studio .NET (VS .NET); you can only create them using program statements. | Using a DataReader Object in Visual Studio .NET You can t visually create a DataReader object in Visual Studio .NET VS .NET you can only create them using program statements. In this section you ll see how to create a SqlDataReader object and use it to retrieve the result set from a SqlCommand object which you saw how to create using VS .NET in the previous chapter. That SqlCommand object contained a SELECT statement that retrieved the CustomerID CompanyName and ContactName columns from the Customers table. You ll see how to execute this SELECT statement read the result set using the SqlDataReader object and display the result set in a ListView control. A ListView control allows you to view information laid out in a grid. Note You can either modify the MyDataReader project you created in the previous chapter or if you don t want to follow along with the instructions in this section you can simply open the completed VS .NET project contained in the DataReader directory. To open the completed project select File Open Project browse to the VS .NETprojects DataReader directory and open the file. If you are modifying your existing Windows application drag a ListView control to your form. Figure shows a form with a ListView control. Make sure the Name property of your ListView is set to listView1 this is the default name so you shouldn t have to change it . Figure Adding a ListView control to the form Warning If you opened the completed project you don t have to add a ListView controI it s already on the completed form. You will need to change the ConnectionString property of the sqlConnection1 object so that it connects to your SQL Server Northwind database. Once you ve set your ConnectionString you can run the form by selecting Debug Start Without Debugging. Next double-click an area on your form outside the ListView control. This causes VS .NET to display the code editor and you ll see the cursor positioned in the Form1_Load method .

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.