public void BuildParameters(SqlParameter[] param, ref SqlCommand comm)
{
//若参数不为空,则添加到命令对象
if (param != null)
{
foreach (SqlParameter par in param)
comm.Parameters.Add(par);
}
//添加返回参数
comm.Parameters.Add(new SqlParameter("returnvalue", SqlDbType.Int, 4, ParameterDirection.ReturnValue, true, 0, 0, string.Empty, DataRowVersion.Default, 0));
return;
}
public void ExecuteProcedure(string proceName, SqlParameter[] param, ref DataSet ds)
{
//打开连接
this.Open();
SqlCommand comm = this.conn.CreateCommand();
comm.CommandText = proceName;
comm.CommandType = CommandType.StoredProcedure;
this.BuildParameters(param, ref comm);
//初始化adapter对象
SqlDataAdapter ada = new SqlDataAdapter(comm);
//返回ds
ada.Fill(ds);
//关闭连接
this.Close();
return;
}这段代码是什么意思?DataSet ds3 = new DataSet();
SqlParameter[] param3 = new SqlParameter[3];
param3[0] = new SqlParameter("@Param_Counter", 7);
param3[1] = new SqlParameter("@Param_num", 12);
param3[2] = new SqlParameter("@Param_types", 1);
this.ExecuteProcedure("proc_customer_knowledge_SelectTitle", param3, ref ds3);
if (ds3 == null || ds3.Tables.Count == 0) return;
this.DataList3.DataSource = ds3;
this.DataList3.DataBind();这段代码应该是将参考传递给上面的那段代码进行调用吧,那个7、12、1表示什么?、?
谢谢各位解答!并请大家帮忙写一个标准的SQL SERVER2000的存储过程,让我参考参考、学习学习!谢谢!
create proc UserReg
(
@UserName varchar(200),
@UserPWd varchar(200),
@tag int output
)
as
if(exists(select * from CMS_UserInfo where UserName=@UserName and UserPwd=@UserPwd))
begin
set @tag=0
return @tag
end
else
begin
insert into CMS_UserInfo(UserName,UserPwd) values(@UserName,@UserPwd)
set @tag=1
return @tag
enddeclare @tag int
exec UserReg 'jijunwu','jijunwu',@tag output
print @tag