雨路IT
当前位置:首页 » it资讯

这句更新数据库的语句该怎么写?

八月 23rd, 2007 by admin



错误提示:字符串   无where   id   =   2   之前有未闭合的引号。第   1   行:   无where   id   =   2   附近有语法错误。    
  请朋友们指点指点  
   
  我是想通过datagrid中的更新按钮来更新数据库  
  有关语句如下  
  string   sql_edit   =   "update   aa   "   +   "set   bb   =   "   +   cc.replace("","")+   "where   id   =   "   +   e.item.cells[0].text;  
  sqlcommand   sqlcommandupdate   =   new   sqlcommand(sql_edit,connupdate);

参考文章:

  • 法律服务热线:律师走到你身边
  • 迪比特6228 vs 西门子M55 简单对比
  • 人工智能 Java 坦克机器人系列: 神经网络,下部
  • Rich Internet Applications 的技术选项
  • 专家评论: Roland Barcia:Java Persistence API 中带注释的命名查询是否真的非常有用…
  • 电信法送审稿向律师界征意见
  • 我心目中的完美手机
  • 进入 Harmony 世界: 研究 Port Layer
  • 基于注释的单元测试框架
  • 驯服 Tiger: 集合框架
  • 网友回答:
    发表者:mummy_zc

    用response.write(sql_edit);  
      resposne.end();输出一下sql_edit就知道了,估计是cc.replace("","")没有返回你想要得值。我感觉应该是cc.replace("","")吧  
     

    发表者:skyword

    改成  
      string   sql_edit   =   "update   aa   "   +   "set   bb   =   "   +   cc.replace("","")+   "   where   id   =   "   +   e.item.cells[0].text;  
       
      看语句你没有写这个引号  
      即set   bb   =  

    发表者:azev

    string   sql_edit   =   "update   aa   "   +   "set   bb   =   "   +   cc.replace("","")+   "   where   id   =   "   +   e.item.cells[0].text;  
       
      where前少了一个单引号

    发表者:caff

    "where   id   =   "   +   e.item.cells[0].text;  
      where前面加个引号试试

    .

    Posted in noname. Edit

    发表评论