ASP.NET 2.0数据库外文文献及翻译和参考文献 第4页
of the site. In this control when you want in a TreeView or Menu control of the site shows a structure of use.
In this article, we will only discuss Sql data source controls, and only of its basic features.
First, let us add a Sql data source controls to your ASP.NET pages. From the design view, Sql data source controls include a "sensitive labels" - it listed its common features. The "Configure Data Source" sensitive labels link will activate a wizard - it will guide you step by step through the entire process of configuration data sources. This wizard there are three main steps (and an optional "sub-steps"):
1. Choose your data connection - the first step, we need to specify what connected to the database. This screen contains the App_Data folder database and a drop-down list in the data connectivity options card in a drop-down list. There is also a "New Connection" button - you can click on it, if you want to connect to a location outside one of these in the database. If you continue, you can choose from the drop-down list box Customers.mdf options.
a) sub-steps: If this is your first time to add the link, you will be prompted whether you want to preserve the connection string to Web.config; and if so, should be connected string of names. If you continue, I choose to use the name connectivity CustomersConnectionString saved to Web.config 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 Web.config 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 ASP.NET 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 ASP.NET 1.x DataGrid control of the "Big Brother" - it provi毕业论文
http://www.751com.cndes 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 ASP.NET page. From the design view, the GridView the sensitive labels include a "Choose Data Source" option and a drop-down list of all the data source controls on this page. This drop-down list is set to SqlDataSource1-that is, we have just added Sql data source controls the ID. Once completed these, the GridView will automatically have a BoundFields added to the above it - from the data source for the return of each 本文来自辣文论文网原文请找QQ752018766Data Source" drop-down 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 complete the paging and two-way 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? » Or maybe you have a ready-made code - the code will make you want accurate data and according to the need for management and once completed, 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 2.0 access to data - through the creation of a connection to the database, to create a command, 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 ASP.NET page Page_Load event processors - its programming to
上一页 [1] [2] [3] [4] [5] 下一页
ASP.NET 2.0数据库外文文献及翻译和参考文献 第4页下载如图片无法显示或论文不完整,请联系qq752018766