OLEDB, SQLClient, ODBC

janilane

Active member
Joined
Jan 23, 2008
Messages
30
Programming Experience
Beginner
Hi,

I know VB.net has created separate components when connecting to a db, depending on one's needs. My question is, am I right to assume that:

1. Dim con1 as SQLClient.SQLConnection
-only is good for .\SQLExpress (SQL 2005 express edition) and Access DB

2. Dim con1 as OLEdb.OLEdbConnection
- is good for connecting to SQL Servers (2000,2005)

3. Dim con1 as Odbc.OdbcSQLConnection
- is good for ODBC-defined data sources?

Will they work when used interchangeably with Access, SQLServer SQL Server Express?

Thanks
 
ODBC and the newer OleDB works for most databases, the former require a DSN configuration. SqlClient and OracleClient is specialized for Sql and Oracle databases. I think the SqlClient stretches far regarding compability with Sql servers, but there is a new one in VB2008 for Sql CE (SqlServerCe) There exist also other data providers for some databases like Oracle and MySql. The specialized drivers usually have better performance and perhaps other unique features.
Browsing http://www.connectionstrings.com is probably interesting for you.
 
cheers John,

Just now I found this from O'Relly site...

"All examples in this chapter assume that the following declaration appears in the same file as the code:

Imports System.Data

Examples that use SQL Server also assume this declaration:

Imports System.Data.SqlClient

and examples that use Access assume this declaration:

Imports System.Data.OleDb "
 
Back
Top