Heim >Datenbank >MySQL-Tutorial >Access中更新一条数据,提示我标准表达式中,数据类型不匹配
这是我的一个函数,运行了一下,就提示数据类型不匹配,该如何解决啊 public int Update(Model.Question model) { StringBuilder strSql = new StringBuilder(); strSql.Append("UPDATE [Question] SET "); strSql.Append("Qid="+model.Qid+","); strSql.App
这是我的一个函数,运行了一下,就提示 数据类型不匹配,该如何解决啊
public int Update(Model.Question model)
{
StringBuilder strSql = new StringBuilder();
strSql.Append("UPDATE [Question] SET ");
strSql.Append("Qid="+model.Qid+",");
strSql.Append("Qtitle=@in_Qtitle,");
strSql.Append("Qcon=@in_Qcon,");
strSql.Append("Qreply=@in_Qreply,");
strSql.Append("Qtime=@in_Qtime,");
strSql.Append("Qrtime=@in_Qrtime,");
strSql.Append("Qname=@in_Qname,");
strSql.Append("Qphone=@in_Qphone,");
strSql.Append("lg="+model.lg+",");
strSql.Append("Qview=@in_Qview");
strSql.Append(" WHERE ID=" +model.ID);
DbParameter[] cmdParms = {
ZDHelper.CreateInDbParameter("@in_Qtitle", DbType.String, model.Qtitle),
ZDHelper.CreateInDbParameter("@in_Qcon", DbType.String, model.Qcon),
ZDHelper.CreateInDbParameter("@in_Qreply", DbType.String, model.Qreply),
ZDHelper.CreateInDbParameter("@in_Qtime", DbType.DateTime, model.Qtime),
ZDHelper.CreateInDbParameter("@in_Qrtime", DbType.DateTime, model.Qrtime),
ZDHelper.CreateInDbParameter("@in_Qname", DbType.String, model.Qname),
ZDHelper.CreateInDbParameter("@in_Qphone", DbType.String, model.Qphone),
ZDHelper.CreateInDbParameter("@in_Qview", DbType.Boolean, model.Qview)
};
return ZDHelper.ExecuteNonQuery(CommandType.Text, strSql.ToString(), cmdParms);
}