PDA

Click to See Complete Forum and Search --> : DSN


Glenn
Apr 26th, 2000, 11:53 PM
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 :)

busted
Apr 27th, 2000, 12:09 AM
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

Glenn
Apr 27th, 2000, 12:16 AM
Here example of where I've used this technique:



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.

busted
Apr 27th, 2000, 12:29 AM
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.

Glenn
Apr 27th, 2000, 03:02 AM
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.