VFP如何调用一个带输出参数的Sql Server存储过程?

我在Sql Server 中创建了一个存储过程


CREATE PROCEDURE usp_Test
@tnNum int,
@tnSQR int output
AS
set @tnSQR = @tnNum * @tnNum


在vfp中我要将8通过存储过程进行平方后写进变量lnSqr
该如何写,请补充下列代码

local lnSqlHandle,lnNum,lnSqr
lnSqlHandle = sqlconnect("mydate,"sa","")
lnNum = 8
lnSqr = 0
&&- 调用

&&- 结果需要lnSqr = 64
---------------------------------------------------------------

local lnSqlHandle,lnNum,lnSqr
lnSqlHandle = sqlconnect("mydate,"sa","")
lnNum = 8
lnSqr = 0
if lnsqlhandle<=0
return
endif
succ=sqlexec(lnsqlhandle,"exec usp_Test ?lnnum,?@lnsqr")
&&注意在返回变量前加@
?lnsqr &&结果为64

Published At
Categories with 数据库类
Tagged with
comments powered by Disqus