标签:函数 演示 end timeout comm procedure trim parameter 示例
PUBLIC errval
PUBLIC errmsg
PUBLIC handle
errval=0
errmsg=‘ ‘
*Sql Server 连接参数
sourcename= ‘test‘
user= ‘sa‘
passwd=‘‘
******** 连接
* 为连接打开错误显示
=SQLSetProp(0,"DispWarning",.t.)
handle=SQLConnect(sourcename,user,passwd)
IF handle > 0
WAIT WINDOW ‘连接成功‘ NOWAIT
ENDIF
******** 设置一些默认值
=SQLSetProp(handle,‘Asynchronous‘,.f.)
=SQLSetProp(handle,‘BatchMode‘,.t.)
=SQLSetProp(handle,‘ConnectTimeOut‘,0)
=SQLSetProp(handle,‘Transactions‘,1)
err=SQLExec(handle,‘use pubs‘)
DO errhand WITH err,‘USE PUBS‘
********** 该程序演示如何实现 SQL 的 SQLExec() 函数
sqlcomm= "execute showsales ‘7066‘"
err=SQLExec(handle,sqlcomm)
DO errhand WITH err,"SQLExec(handle,"+sqlcomm+")"
IF err > 0
BROWSE
ENDIF
********** 断开
err=SQLDisconnect(handle)
DO errhand WITH err,"SQLDisconnect()"
CLOSE ALL
********** 错误处理程序
PROCEDURE errhand
PARAMETERS err,command
IF err > 0
WAIT WINDOW ALLTRIM(UPPER(command))+"完全成功" NOWAIT
ELSE
WAIT WINDOW UPPER(command)+"没有完全成功"
ENDIF
RETURN
注意程序返回两个 stor_id 为 7066 的记录.
标签:函数 演示 end timeout comm procedure trim parameter 示例
原文地址:https://www.cnblogs.com/hnllhq/p/12311284.html