|
-
Jun 1st, 2002, 12:05 AM
#1
Thread Starter
New Member
connectivity of vb6with MS-Access
how can we connect with ms-access?
-
Jun 1st, 2002, 12:46 AM
#2
It can be in this way
<vbcode>
Public conn As ADODB.Connection
Public rsWord As ADODB.Recordset
Set conn = New Connection
With conn
.Provider = "Microsoft.Jet.OLEDB.4.0"
' or you can use 3.51 also
.ConnectionString = App.Path & "\YourDatabase.mdb"
' specify path if database not located in project directory and then mdb name
.Open
End With
Set rsWord = New Recordset
If rsWord .State = adStateOpen Then rsWord .Close
rsWord .Open "Select * from employee ", conn, adOpenKeyset, adLockOptimistic
txtempno = rsWord !empno ' or rsGmHira.Fields(0) like that
</vbcode>
Regards
Gary
-
Jun 1st, 2002, 12:59 PM
#3
Frenzied Member
Just to expand on champgary's information a little:
1. For this code to work you will need to set a reference (Project | References) to Microsoft ActiveX Data Objects 2.x
2. This provider string: .Provider = "Microsoft.Jet.OLEDB.4.0" is appropriate for Access 2000 mdb's
3. You can use this provider string: .Provider = "Microsoft.Jet.OLEDB.3.51" for Access97
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|