|
-
Mar 17th, 2000, 02:56 AM
#1
Thread Starter
Junior Member
Hi,
I'm using Access 2000. I want to use a DSN name to open the database. The provider I'm using is "Microsoft.Jet.OLEDB.4.0". I'm not sure whether I can give a DSN with this provider. Can anyone please let me know if it is possible to use DSN for "Microsoft.Jet.OLEDB.4.0" and if yes, how do I do it???
Thanks in advance.
-
Mar 17th, 2000, 04:39 AM
#2
There are 2 ways to do it.
First, you can create a DSN in the Control Panel (ODBC applet) and then using that DSN to connect:
Code:
Dim cn As New ADODB.Connection
cn.Open "DSN=MyDSN"
Where MyDSN is a DSN you've created.
Or you can use DNSless connection:
Code:
Dim cn As New ADODB.Connection
cn.Provider = "Microsoft.Jet.OLEDB.4.0"
cn.Open "C:\MyDB.mdb", "admin", ""
Assuming that C:\MyDB.mdb is your database.
-
Mar 17th, 2000, 04:47 AM
#3
Thread Starter
Junior Member
I want to use a DSN to connect to the database, but if I give the provide as "Microsoft.Jet.OLEDB.4.0" and use a DSN it gives me an error. How can I use a DSN with this provider????? This is the connection I'm using, but it gives ma an error when I run it....
Cnn.Provider = "Microsoft.Jet.OLEDB.4.0"
Cnnstring = "DSN=MyData"
Cnn.Open Cnnstring
Edited by Pinky on 03-17-2000 at 04:49 PM
-
Mar 17th, 2000, 04:58 AM
#4
Addicted Member
What is the error you are getting ?
-
Mar 17th, 2000, 05:17 AM
#5
Thread Starter
Junior Member
I'm getting Run-time error '-2147467259(800004005)': Could not find the file(.mdb)
-
Mar 17th, 2000, 10:22 AM
#6
Did you physically create the DSN in the control panel???
If yes, then check the path to the database you specified.
If no, then you would have to create the DSN first.
Also, if you have DSN, then you don't have to specify the Provider, DSN will take care of that (using the Microsoft Access Driver).
-
Mar 19th, 2000, 01:41 AM
#7
Guru
I don't think that DSNs can be used with Access 2000 databases -- I've tried using a DSN with DAO 3.6 and Jet 4.0 providers and I get UNRECOGNIZED DATABASE FORMAT....MS Support says to create the DSN using the new driver versions, but I don't see where I get that option, even though I have Access 2000 installed....
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|