|
-
Nov 3rd, 2000, 05:25 PM
#1
Thread Starter
Addicted Member
Using ADO in VB, how do you execute an Access query? I've tried treating it like a stored procedure with no success. Surely Microsoft didn't leave a huge hole like this in one of it's main programming solutions on purpose!
-
Nov 3rd, 2000, 05:54 PM
#2
Frenzied Member
Can you be more specific?
If you are trying to get the recordset returned by an existing query in Access, this works for me:
Code:
Dim cn As New ADODB.Connection
Dim rs As New ADODB.Recordset
cn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=C:\WINDOWS\Desktop\MyDatabase.mdb"
cn.Open
rs.Open "MyQueryName", cn
' Now rs holds the results of your query
' Do what you want with it here
Set rs = Nothing
Set cn = Nothing
Does that help?
-
Nov 3rd, 2000, 06:01 PM
#3
Thread Starter
Addicted Member
That's way too easy, and it also works. Where is this documented? I looked all over the place and couldn't find anything on it. Thanks for your help.
-
Nov 3rd, 2000, 07:36 PM
#4
Frenzied Member
I used ADO 2.1 Programmer's Reference by David Sussman, WROX publishing
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
|