文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>奇怪了...

奇怪了...

时间:2011-03-04  来源:双魂人生

public void Update(Maticsoft.Model.Anli model)
  {
   StringBuilder strSql=new StringBuilder();
   strSql.Append("update CN_Anli set ");
   strSql.Append("title=@title,");
   strSql.Append("photo=@photo,");
   strSql.Append("links=@links,");
   strSql.Append("content=@content");
   strSql.Append(" where id=@id ");
            OleDbParameter[] parameters = {
     new OleDbParameter("@id", OleDbType.Integer,4),
     new OleDbParameter("@title", OleDbType.VarChar,200),
     new OleDbParameter("@photo", OleDbType.VarChar,200),
     new OleDbParameter("@links", OleDbType.VarChar,200),
     new OleDbParameter("@content", OleDbType.VarChar,0)};
   
   parameters[0].Value = model.id;
   parameters[1].Value = model.title;
   parameters[2].Value = model.photo;
   parameters[3].Value = model.links;
   parameters[4].Value = model.content;

   DbHelperOleDb.ExecuteSql(strSql.ToString(),parameters);
  }

这样写竟然不行,原因是id比较放在最后,即:

public void Update(Maticsoft.Model.Anli model)
  {
   StringBuilder strSql=new StringBuilder();
   strSql.Append("update CN_Anli set ");
   strSql.Append("title=@title,");
   strSql.Append("photo=@photo,");
   strSql.Append("links=@links,");
   strSql.Append("content=@content");
   strSql.Append(" where id=@id ");
            OleDbParameter[] parameters = {
     
     new OleDbParameter("@title", OleDbType.VarChar,200),
     new OleDbParameter("@photo", OleDbType.VarChar,200),
     new OleDbParameter("@links", OleDbType.VarChar,200),
     new OleDbParameter("@content", OleDbType.VarChar,0),
                    new OleDbParameter("@id", OleDbType.Integer,4)};
   parameters[0].Value = model.title;
   parameters[1].Value = model.photo;
   parameters[2].Value = model.links;
   parameters[3].Value = model.content;
            parameters[4].Value = model.id;

   DbHelperOleDb.ExecuteSql(strSql.ToString(),parameters);
  }

 郁闷...

 

相关阅读 更多 +
排行榜 更多 +
辰域智控app

辰域智控app

系统工具 下载
网医联盟app

网医联盟app

运动健身 下载
汇丰汇选App

汇丰汇选App

金融理财 下载