TAILIEUCHUNG - Creating a Command Object Using Visual Studio .NET

Creating a Command Object Using Visual Studio .NET To create a SqlCommand object using Visual Studio .NET (VS .NET), you drag a SqlCommand object from the Data tab of the Toolbox to your form. | Creating a Command Object Using Visual Studio .NET To create a SqlCommand object using Visual Studio .NET VS .NET you drag a SqlCommand object from the Data tab of the Toolbox to your form. You can also drag an OleDbCommand object from the Data tab of the Toolbox to your form. Before you perform the procedure explained in this section do the following 1. Create a new project named MyDataReader containing a Windows application. 2. Add a SqlConnection object to your project refer back to the previous chapter to see how to add a SqlConnection object using VS .NET . This object will have the default name of sqlConnectionl. 3. Configure your sqlConnectionl object to access your Northwind database. Drag a SqlCommand object to your form. Figure shows a form with a SqlCommand object. This object is assigned the default name of sqlCommandl. Figure A SqlCommand object in a form You then set the Connection property for your sqlCommandl using the drop-down list to the right of the Connection property in the Properties window. You can select an existing Connection object from the drop-down list you can also create a new Connection object by selecting New from the list. For this example select your existing sqlConnection1 object for the Connection property of your sqlCommandl object as shown in Figure . You can use Query Builder to create a SQL statement by clicking on the ellipsis button to the right of the CommandText property and you can set parameters for a command by clicking the ellipsis button to the right of the Parameters property. You ll set the CommandText property of your SqlCommand object to a SELECT statement that retrieves the CustomerID CompanyName and ContactName columns from the Customers table. You ll construct this SELECT statement using Query Builder. To get started click the ellipsis button to the right of the CommandText property for your SqlCommand object. In the Add Table dialog select the Customers table as shown in Figure . Click the Add

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.