Actions in the database in ASP.NET ---- Connection and open the database

xiaoxiao2021-03-31  214

For users who have used Beta2 version, the content of learning this article will be very simple, because .NET official version and beta2 version is not big, so you can almost no modification for Beta2 (or only a small amount) Modify) You can regret normal running. Here we tell how to open the database, we don't agree with the text editor such as writing or editplus to write ASP.NET, so this article is all on the VS.NET development tool. Create a new database connection, first we double-click OLEDBCONNECTION or double-click SqlConnection as shown in the tool.

Note: The difference between OLEDBConnection and SqlConnection is that OLEDBConnection is suitable for connecting any type of database (such as Oracle, SQL Server, Access, etc.), and SQLConnection is specifically used to connect SQL Server (MS SQL) database, which is said to be efficient than OLEDBConnection . If your database is MS SQL, then you double-click SqlConnection, other databases use OLEDBCONNECTION. The same reason, SQLDataAdapter, SQLCommand is specifically used for (MS SQL) database, while OLEDBDataAdapter, OLEDBCommand applies to all databases, if you double-click SqlConnection, then in future database operations you can only use SqlDataAdapter, SqlCommand, same The reason If you double-click OLEDBCONNECTION, you can only use oleDbdataadapter, OLEDBCommand in future database operations. Here we choose OLEDBCONNECTION. When we double-click OLEDBConnection, a database connection source named OLEDBConnection1 will appear at the lower end of the window.

We can change the name of OLEDBCONNECTION1 in the property window to MyConnection.

Connecting the database In the key steps for: Select and then pop up the following window from the CONNCTIONSTR in the above image:

Select the type of "Next" to "Next" after selecting the correct location of the database as shown below

转载请注明原文地址:https://www.9cbs.com/read-130771.html

New Post(0)