sql 中的返回值

chenxyon 2001-12-04 07:18:06
各为高手,如何在sql 中将储存过程中的返回值在VB中使用。
...全文
77 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
hhbll_2001 2001-12-04
  • 打赏
  • 举报
回复
Dim cmd As New ADODB.Command
Dim ParamA As New ADODB.Parameter
ParamA.Type = adInteger
ParamA.Direction = adParamOutput '定义为输出参数
cmd.Parameters.Append ParamA
......
cmd.Execute
MsgBox ParamA.Value 'text1.text=parama.value

cqq_chen 2001-12-04
  • 打赏
  • 举报
回复
Dim cmd As New ADODB.Command
Set cmd.ActiveConnection = cn
With cmd
.CommandType = adCmdStoredProc
.CommandText = "Update_TPers"
.Parameters.Refresh
xh.Col = 2
xh.Row = 1
.Parameters("@FNumber") = xh.Text
.Parameters("@FNumber").Direction = adParamInput
xh.Col = 2
xh.Row = 2
.Parameters("@FName") = xh.Text
.Parameters("@FName").Direction = adParamInput
xh.Col = 2
xh.Row = 3
.Parameters("@FSex") = xh.Text
.Parameters("@FSex").Direction = adParamInput
xh.Col = 2
xh.Row = 4
.Parameters("@FBegDate") = xh.Text ' Format(xh.Text, "yyyy-mm-dd")
.Parameters("@FBegDate").Direction = adParamInput
xh.Col = 2
xh.Row = 5
.Parameters("@FDeprNumber") = xh.Text
.Parameters("@FDeprNumber").Direction = adParamInput
xh.Col = 2
xh.Row = 6
.Parameters("@FDeprName") = xh.Text
.Parameters("@FDeprName").Direction = adParamInput
xh.Col = 2
xh.Row = 7
.Parameters("@FZyName") = xh.Text
.Parameters("@FZyName").Direction = adParamInput
xh.Col = 2
xh.Row = 8
.Parameters("@FZbName") = xh.Text
.Parameters("@FZbName").Direction = adParamInput
xh.Col = 2
xh.Row = 9
.Parameters("@FXlName") = xh.Text
.Parameters("@FXlName").Direction = adParamInput
xh.Col = 2
xh.Row = 10
.Parameters("@FGbName") = xh.Text
.Parameters("@FGbName").Direction = adParamInput
xh.Col = 2
xh.Row = 11
.Parameters("@FHjName") = xh.Text
.Parameters("@FHjName").Direction = adParamInput
xh.Col = 2
xh.Row = 12
If xh.Text = "" Then
.Parameters("@FEndDate") = Null
.Parameters("@FEndDate").Direction = adParamInput
Else
.Parameters("@FEndDate") = Format(xh.Text, "yyyy-mm-dd")
.Parameters("@FEndDate").Direction = adParamInput
End If
xh.Col = 2
xh.Row = 13
.Parameters("@FZj") = xh.Text
.Parameters("@FZj").Direction = adParamInput
xh.Col = 2
xh.Row = 14
.Parameters("@FBank") = xh.Text
.Parameters("@FBank").Direction = adParamInput
xh.Col = 2
xh.Row = 15
.Parameters("@FQb") = xh.Text
.Parameters("@FQb").Direction = adParamInput
xh.Col = 2
xh.Row = 16
.Parameters("@FSj") = xh.Text
.Parameters("@FSj").Direction = adParamInput
xh.Col = 2
xh.Row = 17
.Parameters("@FKc") = xh.Text
.Parameters("@FKc").Direction = adParamInput
xh.Col = 2
xh.Row = 18
.Parameters("@FKj") = xh.Text
.Parameters("@FKj").Direction = adParamInput
xh.Col = 2
xh.Row = 19
.Parameters("@FKh") = xh.Text
.Parameters("@FKh").Direction = adParamInput
xh.Col = 2
xh.Row = 20
.Parameters("@FHtDate") = IIf(Len(xh.Text) = 0, Null, Format(xh.Text, "yyyy-mm-dd"))
.Parameters("@FHtDate").Direction = adParamInput
xh.Col = 2
xh.Row = 21
.Parameters("@FAddress") = xh.Text
.Parameters("@FAddress").Direction = adParamInput
xh.Col = 2
xh.Row = 22
.Parameters("@FBirthday") = IIf(Len(xh.Text) = 0, Null, Format(xh.Text, "yyyy-mm-dd"))
.Parameters("@FBirthday").Direction = adParamInput
xh.Col = 2
xh.Row = 23
.Parameters("@FNote") = xh.Text
.Parameters("@FNote").Direction = adParamInput
.Parameters("@FFull") = strFull
.Parameters("@FFull").Direction = adParamInput
.Execute
End With

Luke_cn 2001-12-04
  • 打赏
  • 举报
回复
用ADO的command 对象来调用存储过程,并且设置一变量来接收存储过程的返回值(如果有的话)。
wangchong 2001-12-04
  • 打赏
  • 举报
回复
什么意思???

7,768

社区成员

发帖
与我相关
我的任务
社区描述
VB 基础类
社区管理员
  • VB基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧