必须声明标量变量 "@ad_name" 50
动软生成的三层,问题是出在dal层吗DAL:publicboolUpdate(Maticsoft.Model.Adminimodel){StringBuilderstrS...
动软生成的三层,问题是出在dal层吗
DAL:
public bool Update(Maticsoft.Model.Admini model)
{
StringBuilder strSql = new StringBuilder();
strSql.Append("update Admini set ");
strSql.Append("ad_name= @ad_name,");
strSql.Append("ad_possword= @ad_possword,");
strSql.Append("ad_ip= @ad_ip,");
strSql.Append("ad_logtime= @ad_logtime");
strSql.Append(" where ad_id= @ad_id");
OleDbParameter[] parameters = {
new OleDbParameter("@ad_name", OleDbType.VarChar,50),
new OleDbParameter("@ad_possword", OleDbType.VarChar,50),
new OleDbParameter("@ad_ip", OleDbType.VarChar,50),
new OleDbParameter("@ad_logtime", OleDbType.Date),
new OleDbParameter("@ad_id", OleDbType.Integer,4)};
parameters[0].Value = model.ad_name;
parameters[1].Value = model.ad_password;
parameters[2].Value = model.ad_ip;
parameters[3].Value = model.ad_logtime;
parameters[4].Value = model.ad_id;
int rows = DbHelperOleDb.ExecuteSql(strSql.ToString(), parameters);
if (rows > 0)
{
return true;
}
else
{
return false;
}
} 展开
DAL:
public bool Update(Maticsoft.Model.Admini model)
{
StringBuilder strSql = new StringBuilder();
strSql.Append("update Admini set ");
strSql.Append("ad_name= @ad_name,");
strSql.Append("ad_possword= @ad_possword,");
strSql.Append("ad_ip= @ad_ip,");
strSql.Append("ad_logtime= @ad_logtime");
strSql.Append(" where ad_id= @ad_id");
OleDbParameter[] parameters = {
new OleDbParameter("@ad_name", OleDbType.VarChar,50),
new OleDbParameter("@ad_possword", OleDbType.VarChar,50),
new OleDbParameter("@ad_ip", OleDbType.VarChar,50),
new OleDbParameter("@ad_logtime", OleDbType.Date),
new OleDbParameter("@ad_id", OleDbType.Integer,4)};
parameters[0].Value = model.ad_name;
parameters[1].Value = model.ad_password;
parameters[2].Value = model.ad_ip;
parameters[3].Value = model.ad_logtime;
parameters[4].Value = model.ad_id;
int rows = DbHelperOleDb.ExecuteSql(strSql.ToString(), parameters);
if (rows > 0)
{
return true;
}
else
{
return false;
}
} 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询