by Aurelie A. Peralta
Overview of ADO.NET
ADO.NET provides consistent access to data sources such as Microsoft SQL Server, as well as data sources exposed through OLE DB and XML. Data-sharing consumer applications can use ADO.NET to connect to these data sources and retrieve, manipulate, and update data.
ADO.NET cleanly factors data access from data manipulation into discrete components that can be used separately or in tandem. ADO.NET includes .NET Framework data providers for connecting to a database, executing commands, and retrieving results. Those results are either processed directly, or placed in an ADO.NET DataSet object in order to be exposed to the user in an ad-hoc manner, combined with data from multiple sources, or remoted between tiers. The ADO.NET DataSet object can also be used independently of a .NET Framework data provider to manage data local to the application or sourced from XML.
The ADO.NET classes are found in System.Data.dll, and are integrated with the XML classes found in System.Xml.dll. When compiling code that uses the System.Data namespace, reference both System.Data.dll and System.Xml.dll. (http://msdn.microsoft.com/en-us/library/h43ks021(VS.71).aspx)
Here are some connection strings for the following providers:
1. System.Data.ODBC
For Microsoft Access Database:
Dim dbconn As New Odbc.OdbcConnection(”Driver={Microsoft Access Driver (*.mdb)};DBQ=” & Application.StartupPath & “\odbcdemodb.mdb”)
For MySQL Database:
Dim dbconn As New OdbcConnection(”DRIVER={MySQL ODBC 3.51 Driver};SERVER=localhost; DATABASE=alternacaredb;USER=root;PASSWORD=; OPTION=3;”)
Note: Install first the mysql-connector-odbc-3.51.22-win32.msi dll add-ons.
2. System.Data.OLEDB
For Microsoft Access Database:
Dim dbconn As New OleDb.OleDbConnection(”Provider=Microsoft.Jet.OLEDB.4.0;Data Source=” & Application.StartupPath & “\odbcdemodb.mdb”)
3. System.Data.SQLClient
For MS SQL Server Database:
Dim dbconn As New SqlClient.SqlConnection(”Data Source=MISBRAIN\SQLEXPRESS;Initial Catalog=registrardb;Integrated Security=True”)
For a sample File Maintenance Module created using VB.Net, download this file:
filemaintenance.rar