Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQLPT question
Message
From
26/07/2002 00:58:02
 
 
To
26/07/2002 00:34:40
General information
Forum:
Visual FoxPro
Category:
Client/server
Title:
Miscellaneous
Thread ID:
00682865
Message ID:
00682868
Views:
27
This message has been marked as a message which has helped to the initial question of the thread.
>Hi,
>
>A function receives a table name and a where condition and is supposed to count the records that meet the condition in a Sql server database.
>
>(calling function)
>lc = has desired value for fieldname
>n = MyCount([tablename],[fieldname = "] + lc + ["])
>
>FUNCTION MyCount
>LPARAMETERS tcTable,tcCondition
>...
>jc = [SELECT COUNT(*) AS c FROM dbo.] + tcTable + [ ] + tcTable ;
>+ IIF(EMPTY(tcCondition),[],[ WHERE ]+ tcCondition)
>lnRetVal = SQLEXEC(lnHandle,jc)
>...
>
>Problem is lnRetVal = -1 because of tcCondition. If tcCondition were blank, no problem.
>
>Any ideas? TIA,

In your tcCondition, make sure you surround string literals with single quotes.
Regards. Al

"Violence is the last refuge of the incompetent." -- Isaac Asimov
"Never let your sense of morals prevent you from doing what is right." -- Isaac Asimov

Neither a despot, nor a doormat, be

Every app wants to be a database app when it grows up
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform