外文文献—aspnet2内容摘要:

ted whether you want to preserve the connection string to。 and if so, should be connected string of names. If you continue, I choose to use the name connectivity CustomersConnectionString saved to in the series. 2. Settings Select statement The next step is to specify what you want to return to record, application of what kind of conditional statements and data back to the sort order. To this end, you can use the wizard to select a data table or view and choose to return to what are, or you can manually enter a SELECT statement. No matter which method is to return to Sql data source controls Customers data from all the shown in the table in other words, it realized SELECT * FROM Customers. 3. Query test you can run against the database of your SELECT query data in order to get back to a preview. Please free to click the Test query button you should see all the data from the Customers table of all records. Once you have configured SqlDataSource, please take some time to look at the Source view and check the data source for Sql controls used by the statement of the tag: < asp:SqlDataSource ID=SqlDataSource1 runat=server ConnectionString=< %$ ConnectionStrings:CustomersConnectionString %> SelectCommand=SELECT * FROM [Customers]> < /asp:SqlDataSource> A few points to note: First of all, ConnectionString property using a new syntax % $% .... This syntax from the file retrieval ConnectionStrings section of the value of the CustomersConnectionString value. In other words, it from Customers access the database connection string the series is in Sql data source controls the Wizard of steps in the preservation of and secondly, SELECT query is in control of the attributes specified in the SelectCommand. These data source controls only its own data and work together. They do not display data. If you through your browser to visit the pages, you will find not generate output. In order to create we have just observed from the data source controls Sql by the return of data, we need to add a data Web control. For this paper, let us use the GridView control you can in the tool box data to find it. The GridView is DataGrid control of the Big Brother it provi 毕业论文 a number of new features. In this paper, we only GridView to a simple analysis of the data binding. Now, we have a GridView control and drag it to your page. From the design view, the GridView the sensitive labels include a Choose Data Source option and a dropdown list of all the data source controls on this page. This dropdown list is set to SqlDataSource1that is, we have just added Sql data source controls the ID. Once pleted these, the GridView will automatically have a BoundFields added to the above it from the data source for the return of each Data Source dropdown list on the GridView the DataSourceID property to choose the data source controls the ID. Sql GridView and through the use of the data source controls, we can in 30 seconds from a blank page to a database of data showed that the contents of the pages. In fact, we can in another 30 seconds to plete the paging and twoway sort, delete, and add to the editor GridView support, now do not talk much about!) 5, connected to a database programming As we see in front, the use of a SqlDataSource retrieve information very quickly, but if you want to programming and access to data what will happen? 187。 Or maybe you have a readymade code the code will make you want accurate data and according to the need for management and once pleted, that is, you will have to modify in a GridView shown in the data. No problem, as you can in 1. X in the same manner in access to data through the creation of a connection to the database, to create a mand, designated for filling a DataReader or DataSet, and then use the control of the DataSource property And DataBind () method of binding the results to the data Web control. The following code shows an page Page_Load event processors its programming tothe Customers table of contents of the database data bundled with GridView control gvCustomers: Protected Sub Page_Load(ByVal sender As Object, _ ByVal e As ) Handles If Not Then 39。 Start by determining the connection string value DimconnStringAsString= (connStringName).ConnectionString 39。 创建一个 SqlConnection 实例 Using myConnection As New SqlConnection(connString) 39。 指定 SQL 查询 Const sql As String = SELECT * FROM Customers 39。 创建一个 SqlCommand 实例 Dim myCommand As New SqlCommand(sql, myConnection) 39。 取回一。
阅读剩余 0%
本站所有文章资讯、展示的图片素材等内容均为注册用户上传(部分报媒/平媒内容转载自网络合作媒体),仅供学习参考。 用户通过本站上传、发布的任何内容的知识产权归属用户或原始著作权人所有。如有侵犯您的版权,请联系我们反馈本站将在三个工作日内改正。