tailieunhanh - murachs asp net 4 web programming with vb 2010 phần 6

và giúp bạn tránh được những vấn đề mà bạn có thể chạy vào khi bạn xây dựng các trang web phức tạp. Đó là lý do tại sao cuốn sách này cung cấp cho bạn các ứng dụng hoàn chỉnh, bao gồm các hình thức web, mã aspx, và mã VB. Tải về ứng dụng miễn phí từ trang web murach, và thử nghiệm với họ trên của riêng bạn để xem họ có giá trị như thế nào. | Chapter 13 How to use SQL data sources 411 The dialog box for saving the connection string in the file The Connectionstrings section of the file connectỉonStrỉngs add names HalloweenConnectionString connectionstrings Data Source localhost aqlexpress Initial CatalogsHalloween Integrated SecuritysTrue providerName connectionStrings Aspx code that refers to a connection string in the file asp SqlDataSource IDs SqlDataSourcel runats server Connectionstrings Connectionstrings HalloweenConnectionString Selectcommands SELECT CategorylD LongName FROM Categories ORDER BY LongName asp SqlDataSource Description applications can store connection strings in the file. If you choose to save the connection string in the file the Connectionstring attribute of the data source control will include a special code that retrieves the connection string from the file. If you choose not to save the connection string in the file the Connectionstring attribute of the data source control will specify the actual connection string. I recommend that you always save the connection string in the file. Then if the location of the database changes you can change the connection string in the file rather than in each data source that uses the connection. Figure 13-4 How to save the connection string in the file Download from Wow eBook 412 Section 3 database programming How to configure the Select statement Figure 13-5 shows how to configure the Select statement for a data source as you proceed through the steps of the wizard. The easiest way to do that is to choose the columns for the query from a single table or view. You can also specify a custom SQL statement or stored procedure as shown later in this chapter. To select columns from a table use the Name drop-down list to select the table. Then check each of the columns you want to .