Here i am again.

I would like to to know how to use/connect a database for my login program to a
Database from another computer.

I will be using 2 pc unit and connect them with a CROSSOVER connection UTP Ethernet cable.

My Dbase will be on the other unit while my app will be on the other one.

My questions are:

What are the Components i will use for my VB App?

Do I have to run my Program on both unit?

Do i have to install VB6 on both unit?

And would i have to use this code?

Set db = New ADODB.Connection
        db.CursorLocation = adUseClient
        db.Open "PROVIDER=Microsoft.Jet.OLEDB.4.0; Data Source=" & App.Path & "\Database.mdb"
    
    Set rs = New ADODB.Recordset
        rs.Open "select * from Users where UserName = '" & txtUser & "'", db, adOpenStatic, adLockOptimistic

How is the code if the source (Dbase) is on another PC..

Really need help on this one. ASAP :'(

Recommended Answers

All 5 Replies

What are the Components i will use for my VB App?

There are no extra components needed, only your MS ActiveX data objects reference which looks as you already have the reference selected if I look at your code.

Do I have to run my Program on both unit?

No, only the database on the one pc(server) and VB6 on the application pc(host)

Do i have to install VB6 on both unit?

No, only on your development pc. The database will reside on the other pc. You do not even have to have MS Access installed on the server pc.

And would i have to use this code?

Almost there, change the connection to -

db.Open "PROVIDER=Microsoft.Jet.OLEDB.4.0; Data Source=\\192.168.0.199\MyOtherPcName\Database.mdb" 'Here you need to get the Ip address of the other pc, enter the pc name where MyOtherPcName is.
 
    Set rs = New ADODB.Recordset
        rs.Open "select * from Users where UserName =" & "'" & txtUser.Text & "'", db, adOpenStatic, adLockOptimistic

This should get you connected.

Thanks for the replies.

I'll try this when i'm at school so i wont closed this topic yet, till it worked.

:)

Thanks again sir.

No problem.

db.Open "PROVIDER=Microsoft.Jet.OLEDB.4.0; Data Source=\\192.168.0.199\MyOtherPcName\Database.mdb" 'Here you need to get the Ip address of the other pc, enter the pc name where MyOtherPcName is.

One question sir, using this code, would i be able to access the Database no matter where i put it (any drive or folder) on the PC unit..?

Yes it will matter. Place directly under the c: drive or a folder under c: drive. Any other folder and you will be denied permission to access the database.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.