Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Passing parameters to SQL proc
Message
From
13/06/2019 14:32:45
 
 
To
13/06/2019 13:22:09
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
01669053
Message ID:
01669066
Views:
61
>>Ok, I'll admit that it's been way too many years than I'd like to admit since I did this out of VFP, but here goes.
>>
>>Got a connection to my SQL DB that works, tested by passing an SQL string like "Select * from [table]" with
>>
>>msql = "Select * from [table] 
>>x=SQLEXEC(mconn, msql, 'Results')
>>
>>
>>And I get a cursor names Results with, you guessed it, results
>>But,
>>
>>lastname = 'Crawford'
>>fname = 'Harold'
>>msql = "exec LookupbyName ?Lname ' " + lastname + " ',?fname '" + fname + " ' "
>>x=SQLEXEC(mconn, msql, 'CSO')
>>
>>
>>I get a box asking for the value of 'Lname', type that in,
>>x returns as -1, with the error message "Incorrect syntax near 'Crawford'
>>?msql shows "exec LookupbyName ?Lname 'Crawford', ?fname 'Harold' "
>>
>>What am I missing?
>
>Does it work with a few changes such as below?
>
>lname = 'Crawford'
>fname = 'Harold'
>msql = "exec LookupbyName ?Lname, ?fname"
>x=SQLEXEC(mconn, msql, 'CSO')
>
>
>I am assuming that the LookupbyName function takes two parameters.

That would be a correct assumption and yes, that does work And actual results

Thanks
"You don't manage people. You manage things - people you lead" Adm. Grace Hopper
Pflugerville, between a Rock and a Weird Place
Previous
Reply
Map
View

Click here to load this message in the networking platform