日期:2014-05-20  浏览次数:20850 次

在更新access数据库时候,sql函数的问题(新手面试题目..急...)
数据库ggxh字段中含有单引号( '),将含有单引号的记录,改为不含单引号
(如:将20*5 's   改为20*5s)

代码:
try
{
      conn.Open();
      string   sql;
      sql   =   "update   user_Info   set   ggxh   =   replace(ggxh, ' ' ' ', ' ')   where   ggxh   like   '% ' '% ' ";
      cmd   =   new   OleDbCommand(sql,conn);
      filterCmd2.ExecuteNonQuery();
      MessageBox.Show( "成功筛拴 ");
}
数据库是access的。
调试错误提示是:replace函数未定义。
求助:原因是什么,为什么认不到replace函数。
谢谢!!!

------解决方案--------------------
sql = "update user_Info set ggxh = "+replace(ggxh, "\ ' ", " ")+ " where ggxh like \ '%\ '%\ ' ";