zoukankan      html  css  js  c++  java
  • 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 的记录. 

  • 相关阅读:
    Linux开发初探
    Linux开发初探
    电脑使用说明书
    电脑使用说明书
    Delegates, Events, and Anonymous Methods 委托、事件与匿名方法
    CSS haslayout
    js与flash结合使用
    sgen.exe" exited with code 1.解决方法
    selenium
    selenium支付高版本的FireFox
  • 原文地址:https://www.cnblogs.com/hnllhq/p/12311284.html
Copyright © 2011-2022 走看看