|
Thread: DSN
-
Apr 26th, 2000, 11:53 PM
#1
Thread Starter
Addicted Member
You set up the DSN using the ODBC applet in the control panel. When you specify that the DSN is for an Access database it will prompt you for the location of the database. The location could be a mapped drive or a UNC name.
When you make your connection in your VB app just use the DSN name in the connect string. This is an easy way to move your database and not have to change any code.
Hope this helps
-
Apr 27th, 2000, 12:09 AM
#2
New Member
You set up the DSN using the ODBC applet in the control panel. When you specify that the DSN is for an Access database it will prompt you for the location of the database. The location could be a mapped drive or a UNC name.
This part I got.. but the next thing is the problem:
What code do I put in the source so the project knows that it has to connect to the DSN I made?
If you could help me on this I'dd be thankfull.
Sjors
-
Apr 27th, 2000, 12:16 AM
#3
Thread Starter
Addicted Member
Here example of where I've used this technique:
Code:
ConnectString = "Provider=MSDASQL.1;Persist Security Info=False;" & _
"Data Source=ECC_CaseDB;PWD=password"
With adoActivity
.ConnectionString = gsConnect
.CursorLocation = adUseClient
.CommandType = adCmdTable
.RecordSource = "tblkp_ActivityTypes"
.Refresh
End With
This example use an ADO data control, however you can use the same connection with any ado connection.
-
Apr 27th, 2000, 12:29 AM
#4
New Member
Uhm.. one question 
This code I have to put it in the Form or on top of the project?
Sounds maybe stupide, but I'm not so long on to this VB thing, so.
But thanks anywhay for the information guys.
-
Apr 27th, 2000, 03:02 AM
#5
Thread Starter
Addicted Member
If your making multiple connections to the same database then you might want to define a form level variable to hold the connect string and then set it in your form load procedure.
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
|