Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Return data from =SQLExec()
Message
General information
Forum:
Visual FoxPro
Category:
Client/server
Miscellaneous
Thread ID:
00065405
Message ID:
00065611
Views:
47
>>>Check out the Developer's Guide (I know, I know: read the book?) starting at the bottom of page 549. It gives an example of using input and output parameters with SQLEXEC.
>>Believe it or not I usually start out by reading the book :) Must have missed something this time. I will go check it out and see if it helps. Thanks for the info.
>>
>>George
>Ok, checked the docs. I was able to get the example to work but not mine (of course). I am including the stored procedure as well as the call I make to execute the sp in hopes that someone has an idea as to what I am doing wrong.
>
>Here is the stored procedure:
>
>CREATE PROCEDURE spgetmin
>	@min_ret varchar(10) OUTPUT
>AS
>
>DECLARE @m_min varchar(10)
>DECLARE @m_assigned varchar(1)
>DECLARE @m_recvd_date datetime
>
>DECLARE gmin SCROLL CURSOR
>	FOR select * from mins where m_assigned='N' ORDER BY m_min
>	FOR UPDATE OF m_assigned
>OPEN gmin
>FETCH FIRST FROM gmin INTO @m_min, @m_assigned, @m_recvd_date
>SELECT @min_ret=@m_min
>BEGIN TRANSACTION
>	UPDATE mins SET m_assigned='Y' WHERE CURRENT OF gmin
>IF @@ERROR <> 0
>
>	BEGIN
>	ROLLBACK TRANSACTION
>
>	END
>ELSE
>	BEGIN
>	COMMIT TRANSACTION
>	END
>
>DEALLOCATE gmin
>
>
>And here is the VFP code I use to execute the stored procedure. What I really want is the output parameter in VFP:
>
>
>consql=SQLCONN('upsize')
>=sqlsetprop(consql,'Asynchronous',.T.)
>sputest=0
>DO WHILE sputest=0
>	sputest=SQLEXEC(consql,"use att_test;{call spgetmin (?@moutput)}")
>ENDDO
>IF sputest=-1
>	lnCount=AERROR(laError)
>	IF lnCount > 0
>		lcErrorMsg=laError[2]
>		nErrorNo=laError[1]
>		nODBCErrorno=laError[5]
>		cErrorMsg=lcErrorMsg+"["+LTRIM(STR(nErrorNo))+":"+LTRIM(STR(nODBCErrorno))+"]"
>		=MESSAGEBOX(cErrorMsg+CHR(13)+'Update Error: Changes Rolled Back')
>	ENDIF
>ENDIF
>=sqldisc(consql)
>
>
>Any help would be GREATLY appreciated!
>Thanks,
>George

Did you declare the variable moutput somewhere in your Fox code before you run the SQLEXEC? The variable has to exist before you use it in the SQLEXEC call.
"It is an important and popular fact that things are not always what they seem. For instance, on the planet Earth, man had always assumed that he was more intelligent than dolphins because he had achieved so much -- the wheel, New York, wars and so on -- whilst all the dolphins had ever done was muck about in the water having a good time. But conversely, the dolphins had always believed that they were far more intelligent than man -- for precisely the same reasons." - Douglas Adams
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform