ADO.NET database programming is relatively complex. The numerous classes, objects, properties, and methods make every programmer feel annoyed. This article aims to introduce the main content of ASP.NET Beta2 database programming to help programmers quickly understand the essence of ADO.NET database programming. 1. Managed Providers If you are a beginner, you may ask, what are \"Managed Providers\"? Managed Providers provide simple methods to connect and access databases, which is somewhat similar to database connections, but of course much more powerful than it. Managed Providers provide two programming interfaces: OleDb and SQL Server. Because SQL Server is Microsoft\'s own product, a special interface for SQL Server is provided. The efficiency of using this interface to access SQL Server should be stronger than using OleDb. NameSpaces All the example programs in this article need to use the following NameSpaces: <%@ Import Namespace=\"System.Data\" %> <%@ Import Namespace=\"System.Data.Oledb\" %>Connection In order to connect to the database, you must use OleDbConnection: Dim objConn as New OleDBConnection (\"Provider=Microsoft.Jet.OLEDB.4.0; Data Source=e:\\sff\\site\\db\\users.mdb\") Of course, you can also use the specific connection method as a variable. After connecting to the database, you must open the database: objConn.Open() In this way, you can use the database. Generally, at the end, we all require closing the database connection: objConn.Close() objConn=NothingCommand After connecting to the database, you can send commands to operate on the database. OleDbCommand allows commands to be sent to operate on the database. According to the SQL statement sent, we can perform almost all operations on the database. Dim objCmd as New OleDbCommand(\"SELECT * From users\", objConn) The above statement creates a Command. Depending on your habits, you can also use the following method: Dim objCmd as New OleDbCommand() objCmd.Connection = objConn objCmd.CommandText = \"SELECT * FROM users\"
You Might Like
Recommended ContentMore
Open source project More
Popular Components
Searched by Users
Just Take a LookMore
Trending Downloads
Trending ArticlesMore