Web Development

General discussion


Database connectivity

By johnsamuel1 ·
I have a doubt.
It is concerning visual basic.
i am building an application.it also involves database connectivity using ado.i use MsAccess.
my database is situated in one computer.We have a network connection.I HAVE TOO RUN THIS APPLICATION in another computer without transfering the database to that computer.
so in datasource argument,how will yo give the path.
for example think my database db1 is situated in the c folder of computer safe1(the name used to log in to this computer).
i have to run the application in safe2 computer without transfering db1 to safe2(the name used to log in to this computer).
how will you give the path of datasource argument.
Sample Code i am using:

Dim cnn As ADODB.Connection
Dim rs As ADODB.Recordset
Set cnn = New ADODB.Connection
cnn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\My Documents\john\db1.mdb;"
This code works OK because the db1.mdb is situated in the same computer where application resides. I want to know the path string to be given when db1.mdb resides in another computer say safe2(the name used to log in to this computer).

This conversation is currently closed to new comments.

Thread display: Collapse - | Expand +

All Comments

Collapse -

by techrep In reply to Database connectivity

Here's how to do it:

Cnn.Open "Provider=Microsoft.Jet.OLEDB.4.0; User ID=admin; Data Source=\\thesharename\databases\db1.mdb;"

You need to give a share name to the drive on the computer that has the database. Then identify the sharename with the double back-slashes in your connect statement. You will probably need to include a user ID in your statement.

Good luck!

Related Discussions

Related Forums