In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly introduces "how to use ASP.NET 2.0". In daily operation, I believe many people have doubts about how to use ASP.NET 2.0. the editor has consulted all kinds of materials and sorted out simple and easy-to-use operation methods. I hope it will be helpful for you to answer the doubts about "how to use ASP.NET 2.0function". Next, please follow the editor to study!
Visual Studio 200***SP.NET 2.0 contains many features and adds new features, all of which are aimed at a common goal of making it easier and faster for developers to write code correctly. In the following text, some important features in Visual Studio 200***SP.NET 2.0 are introduced.
No problem, you can access data in Visual Studio 200***SP.NET 2.0 just like you did in 1.x-by creating a connection to the database, creating a command, specifying a query, populating a DataReader or DataSet, and then using the control's DataSource property and the DataBind () method to bind the results to the data Web control.
The following code shows a Page_Load event handler for an ASP.NET page-it programmatically binds the contents of the Customers database data table to the GridView control gvCustomers:
Protected Sub Page_Load (ByVal sender As Object, _ ByVal e As System.EventArgs) Handles Me.Load If Not Page.IsPostBack Then 'Start by determining the connection string value Dim connString As String = ConfigurationManager.ConnectionStrings (connStringName). ConnectionString' create a SqlConnection instance Using myConnection As New SqlConnection (connString) 'specify SQL query Const sql As String = "SELECT * FROM Customers"' create a SqlCommand instance Dim myCommand As New SqlCommand (sql MyConnection) 'retrieve a DataSet Dim myDataSet As New DataSet' create a SqlDataAdapter query Dim myAdapter As New SqlDataAdapter (myCommand) myAdapter.Fill (myDataSet) 'bind DataSet to GridView gvCustomers.DataSource = myDataSet gvCustomers.DataBind ()' close the connection myConnection.Close () End Using End If End Sub
Here, we should pay attention to a few points: in order to get the connection string, we can refer to the connection string setting in Web.config-use the syntax for
ConfigurationManager.ConnectionStrings (connStringName) .ConnectionString. Where the value of connStringName should be the value specified in the substep of the Sql data Source Control Wizard (CustomersConnectionString). Also note that Visual Basic 8 (the VB version used in 2. 0) now supports the Using keyword-a language feature that was only suitable for C # in previous versions. Programmatically accessing data and outputting results is equivalent to using Sql data source controls.
At this point, the study on "how to use ASP.NET 2.0" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.