• VFP执行 SQL Server 储存过程示例


    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 的记录. 

  • 相关阅读:
    poj 2000
    poj1316
    poj1922
    poj2017
    poj1833 排列
    poj1338
    poj2136
    poj2242
    IE兼容html5标签
    绑定事件后,某些情况下需要解绑该事件
  • 原文地址:https://www.cnblogs.com/hnllhq/p/12311284.html
Copyright © 2020-2023  润新知