Hi,
What are the connect strings in VB – DAO for connecting to SQL Server? Thanks…
Regards,
88
![]() |
Patch reliability is unclear. Unless you have an immediate, pressing need to install a specific patch, don't do it. |
SIGN IN | Not a member? | REGISTER | PLUS MEMBERSHIP |
Home » Forums » AskWoody support » Productivity software by function » Visual Basic for Applications » DAO – Connect String (VB ver6)
DAO is Jet specific, but you can use it to create ODBC links to SQL Server tables and you can use it to manipulate the data in those tables. The queries, etc. run in Access/Jet (that is, at the client) rather than on the server, but they do run, albeit slowly at times. The older data controls in VB are DAO-based.
So are you using a ‘temp’ .mdb when using DAO in VB to communicate with an SQL Server?
Isn’t it just faster to use ADO then, since it is already using ODBC. It may not be faster, but it should be the same speed. DAO is faster with Jet, but if it is going through ODBC to use other data sources, it must be comparable in speed then.
> Isn’t it just faster to use ADO then, since it is already using ODBC.
Just a footnote that with ADO you might not be using ODBC at all. You can choose your database “provider” with ADO: either the “native” SQL Server OLE DB provider -or- the generic OLE DB provider for ODBC data sources coupled with the SQL Server ODBC driver. One would think the first method would be faster, but I haven’t done any testing of that theory.
You may be right, but then again, and this is just from my memory, which is not 100% lately , I seem to remember that ADO still goes through the ODBC layer, no matter what provider you use. (For example, I use the Microsoft.Jet.OLEDB.4.0 driver when communicating with an Access database. However, from what I understand, that is still using ODBC….I could be completely wrong on that…..who knows….if anyone really wants to know, I suppose someone could look it up on MS’s ADO dev site.)
Well, I’m only reporting the official line. To use the generic OLE DB provider for ODBC, your connection string looks like this (the first line is optional/default):
“Provider=MSDASQL;” & _
“Driver={Microsoft Access Driver (*.mdb)};” & _
“DBQ=XXXXX.mdb” & _
“SystemDB=YYYYY.mdw;” & _
“UID=ZZZZZ;PWD=;”
To use the native OLE DB provider for Jet, on the other hand, your connection string looks like this:
“Provider=Microsoft.Jet.OLEDB.4.0;” & _
“Data Source=XXXXX.mdb” & _
“Jet OLEDB:System Database=YYYYY.mdw;” & _
“User ID=ZZZZZ;Password=”
In reviewing an old thread on the WROX P2P site (involving me, so I could find it quickly), “Ken” posted this link: Reasons to use the native Jet OLEDB Provider.
Oh hey, here’s a Microsoft article that has a downloadable comparison showing how to set up all the various connection types: FILE: MDACCON.EXE Using Connection Strings with ODBC/OLEDB/ADO/RDS (I didn’t try it).
Hope this helps in some way…
Donations from Plus members keep this site going. You can identify the people who support AskWoody by the Plus badge on their avatars.
AskWoody Plus members not only get access to all of the contents of this site -- including Susan Bradley's frequently updated Patch Watch listing -- they also receive weekly AskWoody Plus Newsletters (formerly Windows Secrets Newsletter) and AskWoody Plus Alerts, emails when there are important breaking developments.
Welcome to our unique respite from the madness.
It's easy to post questions about Windows 11, Windows 10, Win8.1, Win7, Surface, Office, or browse through our Forums. Post anonymously or register for greater privileges. Keep it civil, please: Decorous Lounge rules strictly enforced. Questions? Contact Customer Support.
Want to Advertise in the free newsletter? How about a gift subscription in honor of a birthday? Send an email to sb@askwoody.com to ask how.
Mastodon profile for DefConPatch
Mastodon profile for AskWoody
Home • About • FAQ • Posts & Privacy • Forums • My Account
Register • Free Newsletter • Plus Membership • Gift Certificates • MS-DEFCON Alerts
Copyright ©2004-2025 by AskWoody Tech LLC. All Rights Reserved.
Notifications