A DSN-less connection is considered to be the preferred method because it is a faster and more efficient way to access the data source. If you use a DSN you must go through the additional ODBC layer in order to access the data store. If you use OLEDB then you are eliminating this layer. Since the connection absorbs a lot of resources, go with the faster method.
'For SQL Server
Dim objConn as ADODB.Connection
Form_Load()
Set objConn = New ADODB.Connection
objConn.Open "Provider = SQLOLEDB; Integrated Security = SSPI; Persist Security Info = False; Initial Catalog = databasename; Data Source = SQLServername"
SQLOLEDB is specific to SQL Server. I'm sure there is an OLEDB provider for Sybase. To find out if you have a Sybase OLEDB, open a VB project and then Add a Data Environment from the Project Menu. Then right-click the connection and then select properties. All of the OLEDB providers will be listed.
I have one more question though. I went to VB, added the Data Environment, etc---and I don't see an OLEDB for Sybase. However, I noticed the OLEDB for ODBC drivers. Is this the same thing as creating an ODBC connection? Will I still be going through the ODBC layer?
I am using "SQL Anywhere Studio 8"(Sybase) and the ODBC driver I used is "Adaptive Server Anywhere 8" and if you are using the connectionstring the provider would be "ASAProv".
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.