Sample Database Connection using ADODB in VB 6.0

‘First Create A Database Connection, Use A Module For DBConnection

Public db As ADODB.Connection

Public Sub DBConnection()

Set db = New ADODB.Connection

db.Open “Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\Sample Code\SampleDB.mdb;Persist Security Info=False”
‘For Password Protected Database
‘ db.Open “Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\Sample Code\SampleDB.mdb;Jet OLEDB:Database Password=yourPassword;”

End Sub

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s