創(chuàng)建存儲過程
CREATE PROCEDURE FPTransBar9
@datestart as datetime, --開始時間
@dateend as datetime, --終止時間
@bar9 as char(9), --9位款號
@shopno as smallint, --店號
@percent as decimal(18,4) OUTPUT
AS 。。。
調(diào)用存儲過程
Public Con As New Connection
Public Cmd As New Command
Dim conStr As String
conStr="Provider=SQLOLEDB.1;Integrated
security=SSPI;database=~"
Con.Open conStr
With Cmd
.ActiveConnection = Con
.CommandType = adCmdStoredProc
.CommandText = "proc_name"
.Parameters.Append .CreateParameter("@datestart",
addbdatetime,adParamInput, ,varDateStart)
.Parameters.Append .CreateParameter("@dateend", addbdatetime,
adParamInput, ,varDateEnd)
.Parameters.Append .CreateParameter("@bar9", adChar, adParamInput,
9,varCharBar9)
.Parameters.Append .CreateParameter("@shopno", adtinyint,
adParamInput,, varIntshopno9)
.Parameters.Append .CreateParameter("@percent", addouble,
adParamoutput, , varDbPercent)
.execute
with cmd
返回輸出參數(shù)
set varDbpercent=cmd.Parameters("@percent").value
|