我正在做一些项目并收到此错误消息:
*过程或函数 SP_XXX 指定了太多参数* 下面是我的 SQL 参数,我通过 ASP c# App 检查了许多站点,但一无所获:) 非常感谢您的帮助!
cmd.Parameters.Add(new SqlParameter() { Value = user.CODE, ParameterName = "@CODE" });cmd.Parameters.Add(new SqlParameter() { Value = CODE, ParameterName = "@OLD_CODE" });
cmd.Parameters.Add(new SqlParameter() { Value = COCODE, ParameterName = "@OLD_COCODE" });
cmd.Parameters.Add(new SqlParameter() { Value = user.COCODE, ParameterName = "@COCODE" });
cmd.Parameters.Add(new SqlParameter() { Value = user.MEMBERTYPE, ParameterName = "@MEMBERTYPE" });
cmd.Parameters.Add(new SqlParameter() { Value = user.ENNAME, ParameterName = "@ENNAME" });
cmd.Parameters.Add(new SqlParameter() { Value = user.ARNAME, ParameterName = "@ARNAME" });
cmd.Parameters.Add(new SqlParameter() { Value = user.NATIONALITY, ParameterName = "@NATIONALITY" });
cmd.Parameters.Add(new SqlParameter() { Value = user.GENDER, ParameterName = "@GENDER" });
cmd.Parameters.Add(new SqlParameter() { Value = user.SPECIAL, ParameterName = "@SPECIAL" });
cmd.Parameters.Add(new SqlParameter() { Value = (object)user.BIRTHDATE ?? DBNull.Value, ParameterName = "@BIRTHDATE" });
cmd.Parameters.Add(new SqlParameter() { Value = user.Religion, ParameterName = "@RELIGION" });
cmd.Parameters.Add(new SqlParameter() { Value = user.QUALIFY, ParameterName = "@QUALIFY" });
cmd.Parameters.Add(new SqlParameter() { Value = user.MEMBERPOS, ParameterName = "@MEMBERPOS" });
cmd.Parameters.Add(new SqlParameter() { Value = (object)user.JOINDATE ?? DBNull.Value, ParameterName = "@JOINDATE" });
cmd.Parameters.Add(new SqlParameter() { Value = (object)user.EXPIRYDATE ?? DBNull.Value, ParameterName = "@EXPIRYDATE" });
cmd.Parameters.Add(new SqlParameter() { Value = user.POBOX, ParameterName = "@POBOX" });
cmd.Parameters.Add(new SqlParameter() { Value = user.WORKTEL, ParameterName = "@WORKTEL" });
cmd.Parameters.Add(new SqlParameter() { Value = user.HOMETEL, ParameterName = "@HOMETEL" });
cmd.Parameters.Add(new SqlParameter() { Value = user.MOBILE, ParameterName = "@MOBILE" });
cmd.Parameters.Add(new SqlParameter() { Value = user.FAX, ParameterName = "@FAX" });
cmd.Parameters.Add(new SqlParameter() { Value = user.EMAIL, ParameterName = "@EMAIL" });
cmd.Parameters.Add(new SqlParameter() { Value = user.WEBSITE, ParameterName = "@WEBSITE" });
cmd.Parameters.Add(new SqlParameter() { Value = user.ACCCODE, ParameterName = "@ACCCODE" });
cmd.Parameters.Add(new SqlParameter() { Value = user.AMOUNT, ParameterName = "@AMOUNT" });
cmd.Parameters.Add(new SqlParameter() { Value = user.PAIDAMOUNT, ParameterName = "@PAIDAMOUNT" });
cmd.Parameters.Add(new SqlParameter() { Value = user.EMIRATE, ParameterName = "@EMIRATE" });
cmd.Parameters.Add(new SqlParameter() { Value = user.MILIT_NO, ParameterName = "@MILIT_NO" });
cmd.Parameters.Add(new SqlParameter() { Value = user.GRADE, ParameterName = "@GRADE" });
//need job
cmd.Parameters.Add(new SqlParameter() { Value = user.NEEDJOB, ParameterName = "@NEEDJOB" });
cmd.Parameters.Add(new SqlParameter() { Value = user.DEBIT, ParameterName = "@DEBIT" });
cmd.Parameters.Add(new SqlParameter() { Value = user.JOBNAME, ParameterName = "@JOBNAME" });
cmd.Parameters.Add(new SqlParameter() { Value = user.BNKNAME, ParameterName = "@BNKNAME" });
cmd.Parameters.Add(new SqlParameter() { Value = (object)user.BNKAMOUNT ?? DBNull.Value, ParameterName = "@BNKAMOUNT" });
cmd.Parameters.Add(new SqlParameter() { Value = user.COMPAGNY, ParameterName = "@COMPAGNY" });
cmd.Parameters.Add(new SqlParameter() { Value = (object)user.COMPAMOUNT ?? DBNull.Value, ParameterName = "@COMPAMOUNT" });
cmd.Parameters.Add(new SqlParameter() { Value = user.PRSN, ParameterName = "@PRSN" });
cmd.Parameters.Add(new SqlParameter() { Value = (object)user.PRSNAMOUNT ?? DBNull.Value, ParameterName = "@PRSNAMOUNT" });
if (user.PIC == null)
cmd.Parameters.Add(new SqlParameter() { Value = DBNull.Value, ParameterName = "@PIC", SqlDbType = System.Data.SqlDbType.Image });
else
cmd.Parameters.Add(new SqlParameter() { Value = user.PIC, ParameterName = "@PIC" });
cmd.Parameters.Add(new SqlParameter() { Value = user.COMPANY, ParameterName = "@COMPANY" });
cmd.Parameters.Add(new SqlParameter() { Value = user.TYPEBLOOD, ParameterName = "@TYPEBLOOD" });
cmd.Parameters.Add(new SqlParameter() { Value = user.PASSPORTNUM, ParameterName = "@PASSPORTNUM" });
cmd.Parameters.Add(new SqlParameter() { Value = user.LEAVENUM, ParameterName = "@LEAVENUM" });
cmd.Parameters.Add(new SqlParameter() { Value = user.POSBEFORE, ParameterName = "@POSBEFORE" });
cmd.Parameters.Add(new SqlParameter() { Value = (object)user.LEAVEDATE ?? DBNull.Value, ParameterName = "@LEAVEDATE" });
cmd.CommandType = System.Data.CommandType.StoredProcedure;
cmd.CommandText = "SP_MSMEMBERS_UPDATE";
cmd.Connection = con;
string constr = ConfigurationManager.ConnectionStrings["ConnectionStrings"].ToString();
con.ConnectionString = constr;
con.Open();
int x = cmd.ExecuteNonQuery();
con.Close();
ALTER PROCEDURE [dbo].[SP_MSMEMBERS_UPDATE]
(
@CODE VARCHAR(10),
@OLD_CODE VARCHAR(10),
@COCODE INTEGER,
@OLD_COCODE INTEGER,
@MEMBERTYPE INTEGER,
@ENNAME VARCHAR(40),
@ARNAME VARCHAR(40),
@NATIONALITY INTEGER,
@GENDER VARCHAR(1),
@SPECIAL VARCHAR(1),
@BIRTHDATE DATETIME,
@RELIGION INTEGER,
@QUALIFY INTEGER,
@MEMBERPOS VARCHAR(40),
@JOINDATE DATETIME,
@EXPIRYDATE DATETIME,
@POBOX VARCHAR(15),
@WORKTEL VARCHAR(30),
@HOMETEL VARCHAR(30),
@MOBILE VARCHAR(30),
@FAX VARCHAR(30),
@EMAIL VARCHAR(40),
@WEBSITE VARCHAR(80),
@ACCCODE VARCHAR(20),
@AMOUNT NUMERIC(15,3),
@PAIDAMOUNT NUMERIC(15,3),
@EMIRATE INTEGER,
@MILIT_NO VARCHAR(40),
@GRADE VARCHAR(20)
--new add
,@NEEDJOB VARCHAR(1)
,@DEBIT VARCHAR(1)
,@JOBNAME varchar(20)
,@BNKNAME varchar(25)
,@BNKAMOUNT NUMERIC(15,3)
,@COMPAGNY nvarchar(25)
,@COMPAMOUNT NUMERIC(15,3)
,@PRSN varchar(30)
,@PRSNAMOUNT NUMERIC(15,3)
,@PIC image
,@COMPANY varchar(25)
,@TYPEBLOOD varchar(20)
,@PASSPORTNUM varchar(20)
,@LEAVENUM varchar(10)
,@POSBEFORE varchar(15)
,@LEAVEDATE datetime
)