Create a Point-and-Click SQL Server Query Tool for Users Using a Windows Form

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. | 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 -Chapter 8 solution. From the main Windows Form click on the command button with the caption How-To . 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 . 1. Create a Windows Form. Then place the controls shown in Figure with the properties set forth in Table . Table . Labels ListBoxes DataGrid TextBox and Command Button Controls Property Settings Object Property Setting Label Name Label 1 Text Tables Label Name Label2 Text .

Không thể tạo bản xem trước, hãy bấm tải xuống
TÀI LIỆU MỚI ĐĂNG
Đã 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.