Đang chuẩn bị liên kết để tải về tài liệu:
Create a Point-and-Click SQL Server Query Tool for Users Using a Windows Form

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

8,3 Tạo một điểm-và-Click SQL Server Query Công cụ cho người dùng sử dụng một khách hàng Mẫu Windows thường muốn có một phương tiện truy vấn các bảng, nhưng họ không nhất thiết phải biết làm thế nào để tạo ra câu lệnh SQL. | 8.3 Create a Point-and-Click SQL Server Query Tool for Users Using a Windows Form Clients usually want a means of querying the tables but they do not necessarily know how to create SQL statements. This example describes how to create a point-and-click query interface using a Windows Form and display fields from individual tables as they are chosen. In just about every application you create your clients need a means to view the data and want to be able to create their own lists. However most don t want to have to learn how to create SQL statements. In this How-To you will see a method for not only creating a point-and-click query tool that will allow the users to examine all tables in the database but also for using the Windows Form in an application without modification. Technique To accomplish the task just presented you will be using the OleDbCommand and DataReader object. Along with these objects you will be using some stored procedures that SQL Server supplies. These stored procedures list the various objects within a SQL Server database-in this case Northwind s tables and columns. You will take the elements returned in the DataReader object and load the Add method of the ListBox object. Steps Open and run the VB.NET -Chapter 8 solution. From the main Windows Form click on the command button with the caption How-To 8.3. The first list box you see to the left is populated with the tables from Northwind. Click on the Customer table and you will see the columns in the next list box labeled Columns. Click on the CompanyName and ContactName and you will see the SQL String text box filled in. After clicking on the View button the form will look like the one displayed in Figure 8.5. 1. Create a Windows Form. Then place the controls shown in Figure 8.5 with the properties set forth in Table 8.4. Table 8.4. Labels ListBoxes DataGrid TextBox and Command Button Controls Property Settings Object Property Setting Label Name Label 1 Text Tables Label Name Label2 Text .