How can I connect my msacces database and use SQL query command like "Select Field FROM Table Where Field1 = foo AND Field2 = foo2" in Visual basic 6 and display the query result to a textbox.
forjustincase
0
Newbie Poster
Recommended Answers
Jump to PostUse the ADODB object library to establish a connection, create a recordset, execute the SQL statement you want and retrieve the records. There are some pretty good examples in the VB help file. Just search for "ADODB".
Jump to PostTry something similar to -
Dim cnCheck As ADODB.Connection Set cnCheck = New ADODB.Connection Dim rsCheck As ADODB.Recordset Set rsCheck = New ADODB.Recordset cnCheck.CursorLocation = adUseClient cnCheck.Open "provider = microsoft.jet.oledb.4.0;persist security info=false;data source = " & App.Path & "\MyDatabaseName.mdb" rsCheck.Open "SELECT Field1, Field2 FROM TableNameHere WHERE Field1='foo' …
All 6 Replies
BitBlt
452
Practically a Master Poster
Featured Poster
AndreRet
526
Senior Poster
forjustincase
0
Newbie Poster
AndreRet
526
Senior Poster
forjustincase
0
Newbie Poster
AndreRet
526
Senior Poster
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.