Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL Statement With Parameters
Message
General information
Forum:
Visual Basic
Category:
Database DAO/RDO/ODBC/ADO
Miscellaneous
Thread ID:
00436355
Message ID:
00436402
Views:
16
>Hello All,
>
>I'm converting a VFP app into VB, and in my code I have two variables, lccompany and lcproperty, that I need to set as parameters in a SQL statement. The VFP query would look something like this:
>
>select code ;
>from c_qcldinco ;
>where company == lccompany and property == lcproperty and type = "R" ;
>into cursor c_rentcode
>
>I believe that I need to use a ADODB.Command object on the ADODB.Connection variable that I've already instantiated on the Access Database.
>
>Can anyone give me or refer me to some example code which would use the values of these variables as parameters in an ADO SQL statement?

You don't absolutely need to use a command object. You can create a simple query like this:

set rst = conn.execute("select code from c_qcldinco " & _
"where company = '" & lccompany & "' and property = '" & lcproperty & _
"' and type = 'R'"
Éric Moreau, MCPD, Visual Developer - Visual Basic MVP
Conseiller Principal / Senior Consultant
Moer inc.
http://www.emoreau.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform