Subscribe

RSS Feed (xml)

Connecting to an ODBC Datasource

Dim connectString As string = "DSN=myDSN;Uid=user;Pwd=pass"

Dim myConn As Microsoft.Data.Odbc.OdbcConnection = _

New Microsoft.Data.Odbc.OdbcConnection( connectString )

Try

myConn.Open()

'do something and then be sure to close the connection...
 
Finally

If Not myConn Is Nothing Then

myConn.Close()

End If

End Try

Comments

According to Carsten Thomsen, author of Database Programming in C#:

The OdbcConnection class, which uses the Platform Invoke feature, is roughly twice as fast for

standard applications than the OleDbConnection.The latter uses COM, which is chatty, and

hence has more server round-trips. So unless your application is shipping large amounts of data

(hundreds of thousands of rows or more) per data request, you should at least consider using

the OdbcConnection class. SqlConnection is roughly 20 percent faster than

OdbcConnection.



Technorati :

No comments:

Archives

Variety in the Web World