Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
ADO Command object with SQL 'where' query ???
Message
 
 
To
22/06/2001 05:38:51
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Miscellaneous
Thread ID:
00522305
Message ID:
00522311
Views:
8
You have two basic choices:

First, you can use client-side rendered SQL. And, you can render where clauses. However, this gets you into concatenating query strings. Altough in Fox, concatenating strings is easy since we have three string delimiters ( ',",[ ), it can become tedious for long expressions. Something like this will work:
oCommand.CommandText = [Select * From customers where status = 'A'] 
oRS = oCommand.Execute
Second, assuming you are using a backend that supports stored procedures, such as SQL Server, I would go this route. When you work with stored procedures, you can begin to work with the parameters collection.

For example, assume you have a stored procedure like this:
Create Procedure Get_Customers @status char(1)
As
Select *
   From customers
   Where status = @status
Your ADO calls would like this:
With oCommand
   .CommandType = 4
   .CommandText = [get_customers]
   .Parameters.refresh
   .Parameters([@status]).Value = [A]
   oRS = .Execute
EndWith
>Hi evrybodey,
>
>we build some components that use ADO Command objects.
>h etables we probe are getting bigger and bigger, thats why we want to be able to get a selection from the tables and not the whole table.
>
>Curently the ADO Command looks like;
>
>'select * from tablename'
>
>We have tried to insert the 'where' clause, but that did not work.
>
>Anybody has the solution for this?
>
>-- Erwin
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform