William,
Here's a couple of examples cut and pasted from some working apps:
---lcLogin is passed by value as a parameter to the method---
lcSQL = "SELECT access_level FROM users "
lcSQL = lcSQL+"WHERE UPPER(RTRIM(login_id)) = ?lcLogin"
lnExec = SQLEXEC(lnConnHandle,'&lcSQL','curAccess')
--lcPartno is passed by value as a parameter to the method--
nExec = SQLEXEC(lnConnHandle,"EXECUTE sp_GetWhereUsed '&lcPartno'","curWhereUsed")
Hope these help.
>Greetings!
>I've got a strange problem with a sql stored procedure [MS-SQL] and passing the parameters to it. There are more notes below - but if you have an idea on this please DO post here and slam a cc: to wsanders@eagleusa.com
>
>TIA!!!!
>code starts here
>***************************
>*[stored procedure code]*
>********* store procedure PICKLISTS_FRM_CONFIRMENTRY ***********
>if exists (select * from sysobjects where id = object_id('dbo.PickLists_Frm_ConfirmEntry') and sysstat & 0xf = 4)
> drop procedure dbo.PickLists_Frm_ConfirmEntry
>GO
>
>CREATE PROCEDURE PickLists_Frm_ConfirmEntry
> @vchFieldList VARCHAR(255)
> AS
>
>
>DECLARE @SelectString VARCHAR(255)
>
>SELECT @SelectString = 'SELECT ' + @vchFieldList + ' FROM Accounts WHERE cAcctNum LIKE "E%"'
>
>EXEC (@SelectString)
>GO
>**********end of stored procedure********************************
>
>Mondo questions::::
>Is it possible to pass the field list for a SQL SELECT statement as a parameter in a store procedure?
>
>The following command works when run through the SQL(ver 6.50.201) query tool:
>
> exec picklists_frm_confirmentry 'cacctnum,cpartyname,ipartykey'
>
>The following commands do not work when run through Visual FoxPro 6.0
>
> lha = sqlconnect("General","sa","")
> CSTRING = "exec picklists_frm_confirmentry 'cacctnum,cpartyname,ipartykey'"
> X= sqlexec(lha,CSTRING,"testcursor")
>----
>X always returns a -1...
>your thoughts, as always, will be most appreciated....
>regards [Bill]
>
>--
>========================================
>William Sanders, Programmer/Analyst[VFP/SQL]
>TALON Development Team, MIS Department [281-618-3100 X 3516]
>EAGLE USA Airfreight, 15350 Vickery Drive, Houston TX 77032
Bob Tracy
Never engage in a battle of wits if you're only half armed.