Vb 6.0

Status
Not open for further replies.

bat2ray

Baseband Member
Messages
29
hi,

I 'm actually want to learn how to connect my database to VB but i dont know how.i would only like to view what is in the database. can anyone help?
 
You're gonna need to pick up a book on database programming in VB 6.0; there's a lot more to it than you may think. I learned the from Dummie's book, but any database book should teach you how. Good luck.
 
Hello,

For good all times try this code.

Private connection As ADODB.Connection
Private recordset As ADODB.Recordset

Private Sub Form_Load()

Const dataBasePath As String = "C:\Program Files\Microsoft Visual Studio\VB98\BIBLIO.MDB"
'let's use the BIBLIO demo database provided with Vb, make sure the path is right.

Set connection = New ADODB.Connection
Set recordset = New ADODB.Recordset

connection.ConnectionString = _
"Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & dataBasePath & ";"
connection.Open

recordset .Open "SELECT * FROM Authors", connection, adOpenDynamic

End Sub

Your recordset will be filled with the set of records from the Author's table of the database. You may want to check for the Recordset class' properties and methods to find more information on what you are trying to do. Good luck.
 
Status
Not open for further replies.
Back
Top Bottom