8.1. Connect to a Database
Problem
You need to open a connection to a database.
Solution
Create a connection object appropriate to the type of database to which you need to connect. Configure the connection object by setting its ConnectionString property. Open the connection by calling the connection object's Open method.
How It Works
The first step in database access is to open a connection to the database. All connection objects inherit from the MustInherit System.Data.Common.DbConnection class. This class implements the System.Data.IDbConnection interface. The DbConnection class represents a database connection, and each data provider includes a unique implementation. Here is the list of the implementations for the five standard data providers: ...
Get Visual Basic 2008 Recipes: A Problem-Solution Approach now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.