tailieunhanh - Create a Point-and-Click Query Tool for Users Using a Web Form
8,7 Tạo một điểm-và-Click Query Công cụ cho người dùng sử dụng một mẫu Web Như hữu ích-nếu không như vậy-hơn ví dụ hiển thị trong 8,3 Làm thế nào để, bài tập này sẽ cho bạn thấy làm thế nào để thêm một công cụ truy vấn dữ liệu hướng đến ứng dụng của bạn. Khi các ứng dụng cơ sở dữ liệu tạo, thậm chí trên Web, | Create a Point-and-Click Query Tool for Users Using a Web Form As useful-if not more so-than the example shown in the How-to this exercise will show you how to add a data-driven query tool to your application. When creating database applications even on the Web one of your clients inevitably wants to be able to examine the data in his database and not necessarily in edit pages. The client wants to be able to list his data out and examine the data at his leisure. Giving the user the flexibility to do this via the Web is not as big of a hassle as it sounds. This How-To will show you how to create a page to view the tables in your database using a nice point-and-click interface. Technique To accomplish the task just presented you will be using the OleDbCommand and DataReader objects. Along with these objects you will be using some stored procedures that SQL Server supplies. Those 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. You will also use the Session object as you did in the previous How-To to save a DataTable object for use over trips to the server. Finally the ViewState object will be used to store a string variable when going to the server and back. The ViewState object is a good .NET state object to use for small pieces of data such as strings. Steps Open and run the -Chapter 8 solution. From the main Web Form click on the hyperlink with the caption How-To Create a Point-and-Click SQL Server Query Tool for Users Using a Web Form. When the new page opens 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 listed in the 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 .
đang nạp các trang xem trước