34,587
社区成员
发帖
与我相关
我的任务
分享
<%
DIM UserName,MailStr
DIM MyComm,MyRst
UserName=session("Rname")
Set MyComm = Server.CreateObject("ADODB.Command")
with MyComm
.ActiveConnection = "Driver={SQL Server};Server=172.19.4.5;DataBase=oamail;uid=wm9001;pwd=wm9001admin" 'MyConStr是数据库连接字串
.CommandText = "pro_InsertMail"
.CommandType = 4
.Prepared = true
.Parameters.append .CreateParameter("@UserName",201,1,100,UserName) '传入参数@username
.Parameters.append .CreateParameter("@MailStr",201,1,5000,mailstr) '传入参数@mailstr
Set MyRst = .Execute()
end with
Set MyComm = Nothing
%>
SET Comm = Server.CreateObject("ADODB.COMMAND")
WITH Comm
.ActiveConnection = strCon '数据库连接字符串
.CommandText = "pro_A" '存储过程名字
.CommandType = 4
.Prepared = True '开启预编译
.Parameters.Append .CreateParameter("@EveryPage",3,1,4,EveryPage) '入参,每页数据条数
.Parameters.Append .CreateParameter("@TotalCount",3,4,4) '出参,总记录数
.Parameters.Append .CreateParameter("@TotalPageCount",3,4,4) '出参,总页数
SET Rs = .Execute
END WITH
Rs.Close '取返回参数要先关闭数据集
TotalCount = Comm.Parameters("@TotalCount")
TotalPageCount = Comm.Parameters("@TotalPageCount")
create pro pro_A
declare @str varchar(1000)
declare @NID int
declare @resulta int output
declare @resultb int output
declare @resultc int output
存储过程不是你这样写的,过程的参数是不需要Declare来定义的.
Create Pro pro_A
@str Varchar(1000),
@NID int,
@resulta Int OutPut,
@resultb Int OutPut,
@resultc Int OutPut
As
Begin
这里是内容
End
public void ExecPro()
{
string ExecSql = "";
string str;
int NID;
int resulta;
int resultb;
int resultc;
str = "传入的参数";
NID = 12;
Hashtable ht = new Hashtable();
ht.Add("str", str);
ht.Add("NID", NID);
ht.Add("resulta", resulta);
ht.Add("resultb", resultb);
ht.Add("resultc", resultc);
//DaoHelper.ExecuteForDataSet(Mapper, "SysProcedure.SP_SetShopAudit", ht);
//回传结果
resulta = Convert.ToInt32(ht["resulta"]);
resultb = Convert.ToInt32(ht["resultb"]);
resultc = Convert.ToInt32(ht["resultc"]);
}