how to write the code of viewing microsoft access database in visual basic?
can u pls help me out of this problem?
i wanna use the visual basic to view the data from the access database
thanks alot
Printable View
how to write the code of viewing microsoft access database in visual basic?
can u pls help me out of this problem?
i wanna use the visual basic to view the data from the access database
thanks alot
Goto Project-References. Add the Microsoft DAO 3.51 Object Library. And copy the follow code to your project.
Dim MyDB As Database, MySet As Recordset
' Open Database:
Set MyDB = OpenDatabase("d:\database.mdb")
'Create Recordset from query and load list with results:
Set MySet = MyDB.OpenRecordset("books") 'Open the Books table
MySet.MoveFirst
While MySet.EOF = False
Debug.Print MySet("name") 'Look the Name field
MySet.MoveNext
Wend
'Clean up - close objects:
MySet.Close
MyDB.Close
Set MySet = Nothing
Set MyDB = Nothing
[email protected]
http://vbcode.webhostme.com/