7,759
社区成员
发帖
与我相关
我的任务
分享
Dim cmd As New ADODB.Command
Dim LastDb As New ADODB.Recordset
'Build the Command object
With cmd
.ActiveConnection = Main_conn
.CommandText = "Pro_DFJS"
.CommandType = adCmdStoredProc
.Parameters.Refresh
.Parameters("@参数名1") = str_CSVfailed '参数名你自己替换成正确的'
.Parameters("@参数名2") = NowPrice '参数名你自己替换成正确的'
……
.Parameters("@参数名n") = str_gongyongft '参数名你自己替换成正确的'
End With
'Create the Recordset
Set LastDb = cmd.Execute
MsgBox rs.Fields("字段名1") '字段名你自己替换成正确的'
rs.Close
Set rs = Nothing
Set cmd = Nothing
Dim str_sql As String
' str_sql = "Exec Pro_DFJS @参数1='" & str_CSVfailed & "',@参数2=" & NowPrice ……
Dim str_jsxx As String
Dim LastDb As New ADODB.Recordset
If Main_conn.State = 0 Then Main_conn.Open
With LastDb
.ActiveConnection = Main_conn
.CursorLocation = adUseClient
.CursorType = adOpenStatic
.LockType = adLockReadOnly
.Open str_sql
While Not .EOF
'如果是0计算失败
If Len(.Fields("bz")) = "0" Then
fault = Trim(.Fields("falut"))
str_jsxx = Trim(.Fields("nr"))
MsgBox str_jsxx, vbInformation, Mytitle
Call faucolor
End If
'如果是1计算成功
If Len(.Fields("bz")) = "1" Then
str_jsxx = "电费计算成功!"
End If
.MoveNext
Wend
.Close
End With
Set LastDb = Nothing