Home > Database > Mysql Tutorial > Access中更新一条数据,提示我标准表达式中,数据类型不匹配

Access中更新一条数据,提示我标准表达式中,数据类型不匹配

WBOY
Release: 2016-06-07 15:43:46
Original
1360 people have browsed it

这是我的一个函数,运行了一下,就提示数据类型不匹配,该如何解决啊 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);
  }

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template