Newbie - VB6.0 with ADO2.5 accessing an ACCESS db using ODBC 
Author Message
 Newbie - VB6.0 with ADO2.5 accessing an ACCESS db using ODBC

Hello everyone,

I am writing a VB control to access a MSAccess db using ADO and ODBC.  I
don't know how to execute query defined in MSAccess.

Here is some thing that works using DAO, but I want it to work with ADO:

    Dim qryTemp As DAO.QueryDef

    Set qryTemp = DB.QueryDefs("qry_Customer")
    qryTemp.Parameters(0).Value =  iCustomerID
    Set rs = qryTemp.OpenRecordset

    ' Loop through Recordset, and fill the list view with appropriate icons
    While Not rs.EOF
        debug.print rs!PhysicianName & "" , rs!SpecialtyName & "" ,
rs!ReferralNote & ""
        rs.MoveNext
    Wend

Thank you in advance

Donald



Sun, 01 Apr 2001 03:00:00 GMT  
 Newbie - VB6.0 with ADO2.5 accessing an ACCESS db using ODBC
Never Mind,  I found this out on MSDN VB60 Data Access section.


Quote:
>Hello everyone,

>I am writing a VB control to access a MSAccess db using ADO and ODBC.  I
>don't know how to execute query defined in MSAccess.

>Here is some thing that works using DAO, but I want it to work with ADO:

>    Dim qryTemp As DAO.QueryDef

>    Set qryTemp = DB.QueryDefs("qry_Customer")
>    qryTemp.Parameters(0).Value =  iCustomerID
>    Set rs = qryTemp.OpenRecordset

>    ' Loop through Recordset, and fill the list view with appropriate icons
>    While Not rs.EOF
>        debug.print rs!PhysicianName & "" , rs!SpecialtyName & "" ,
>rs!ReferralNote & ""
>        rs.MoveNext
>    Wend

>Thank you in advance

>Donald



Sun, 01 Apr 2001 03:00:00 GMT  
 Newbie - VB6.0 with ADO2.5 accessing an ACCESS db using ODBC
Never Mind,  I found this out on MSDN VB60 Data Access section.


Quote:
>Hello everyone,

>I am writing a VB control to access a MSAccess db using ADO and ODBC.  I
>don't know how to execute query defined in MSAccess.

>Here is some thing that works using DAO, but I want it to work with ADO:

>    Dim qryTemp As DAO.QueryDef

>    Set qryTemp = DB.QueryDefs("qry_Customer")
>    qryTemp.Parameters(0).Value =  iCustomerID
>    Set rs = qryTemp.OpenRecordset

>    ' Loop through Recordset, and fill the list view with appropriate icons
>    While Not rs.EOF
>        debug.print rs!PhysicianName & "" , rs!SpecialtyName & "" ,
>rs!ReferralNote & ""
>        rs.MoveNext
>    Wend

>Thank you in advance

>Donald



Sun, 01 Apr 2001 03:00:00 GMT  
 Newbie - VB6.0 with ADO2.5 accessing an ACCESS db using ODBC

Quote:
> Here is some thing that works using DAO, but I want it to work with ADO:

you can open a Commmand object based on the query (set the COmmandType property to be
adCmdTable) and then just call the thing as in:

  Set rst  = cmd.Execute (Parameters:=Array("Dogs", 12))

(assuming your query requires two parameters, one a string, and the other a number. -- Ken



Sun, 01 Apr 2001 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. VB6 - Newbie needs SQL help sorting using dates in Access DB

2. display chinese using DAO 3.6/VB6 in accessing Access 2000 DB.

3. Convert Access 97 db to Access 2000 db in VB6

4. export data from one access db to same db on another machine using vb6

5. Newbie - MSChart connect to Access db with VB6?

6. VB3 using Access 2.0 db thru ODBC

7. Binary fields MS-Access DB using ODBC

8. HELP: Using Access DB from VB through ODBC

9. Problem writing to Access 97 DB with ADO 1.5 and 2.1 (using ODBC)

10. Newbie: problems using a multi-table Access DB and Recordsets

11. VB6.0 /ADO2.5/Access 2000 Docs ?

12. VB6, ADO2.5 and Access 97 freezes Outlook

 

 
Powered by phpBB® Forum Software