Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Parameterized views
Message
 
To
14/09/2001 14:56:29
Jim Rieck
Quicken Loans/Rock Financial/Title Sourc
Livonia, Michigan, United States
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Miscellaneous
Thread ID:
00556657
Message ID:
00556737
Views:
17
Why not write a program that accepts the parameter, runs sqlexec() and returns say a logical that tells if the operation was succesful. Something like:

PARAMETERS cState

LOCAl lcCommand, lnSQLConnect, lcCurAlias

lnSQLConnect = SQLConnect(...)
lcCommand = "SELECT * FROM Addresses WHERE State = '" + cState + "'"
lcCurAlias = "MYSQLCURSOR"

IF SQLEXEC(lnSQLConnect, lcCommand, lcCurAlias) = 1
IF RECCOUNT("MYSQLCURSOR") > 0
llResult = .T.
ELSE
llResult = .F.
ELSE
llResult = .F.
ENDIF

RETURN llResult

HTH,
Arriyel

>Is there a way to do this on the server side? So the view would have to accept a parameter to run.
>
>Thanks
>
>Jim
>
>>Declare a local (or private or public) variable. Assing it a value. Reference it in your select statemnt preceeded with a '?'. Like this:
>>
>>
>>local lcValue, lcCmd, liResult, liHandle
>>
>>lcValue = "TX"
>>
>>lcCmd = "select * from addresses where state = ?lcState"
>>liHandle = sqlconnect(...)
>>liResult = sqlexec(liHandle, lcCmd, "myAddresses")
>>
>>
>>>Hi All,
>>>
>>> I know how to set and pass a parameter to a view in Foxpro. Does anyone know if it is possible and/or how to do the same thing using SQL Server 7.0?
>>>
>>>Thanks
>>>
>>>Jim
Speak using soft and sweet words in case you have to eat them later.
Previous
Reply
Map
View

Click here to load this message in the networking platform