Link to home
Start Free TrialLog in
Avatar of ashraf_t
ashraf_t

asked on

VB & Connection to access database

by using the visual basic 6 and ADO , can i connect to access database file located in a site on the internet , if this possible , how can i do this

PS: i can make this conncetion using the ASP.Net , i tried to use the same method inside the VB but it doesnot work

Thanx
Avatar of OzWolf
OzWolf

First off, you need to create a system DSN entry in Windows that points to the database at it's correct location.

What you then need to do is use an ODBC connection to connect to the database.

An example connection might be:

----------------------------------------------------------

dim ODBCCon As ADODB.Connection
dim strCon as String

Set ODBCCon = New ADODB.Connection

strCon = "DSN=Internet_Access_DB; uid=admin; password=some_password; database=internet.mdb"

ODBCCon.Open strCon, "admin", "some_password"

----------------------------------------------------------

There you go.  This assumes that you have created an ODBC (System DSN) entry called Internet_Access_DB that points to the database internet.mdb.

Hope it helps.
Avatar of ashraf_t

ASKER

that is the problem , how to create this DSN file ?
ASKER CERTIFIED SOLUTION
Avatar of OzWolf
OzWolf

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
can u pls tell me one of the sites you had tested it , i prefer it free just for test ,
i tried to do what you said with my site but always get an error message the folder is invalid
I actually did it on a private site (based in another city) and it worked.  Some free sites actually block outside access via this method (and FTP) due to the possible bandwidth abuse that can occur.  However, look for free website hosts that allow FTP access and you should be able to use the above method to access the database.