Undefined function 'Replace' in expression

前端 未结 2 2008
夕颜
夕颜 2021-01-21 03:11

I am having a VB.Net application. I connect it with a MS Access database. Now I have to execute a query. My query is : Update table1 set field1=replace(field1,\'|\',\'\"\'

2条回答
  •  佛祖请我去吃肉
    2021-01-21 03:30

    The currently-accepted answer to this question is somewhat outdated. Using

    Provider=Microsoft.ACE.OLEDB.12.0

    the following C# code works just fine:

    cmd.CommandText =
        "UPDATE table1 SET field1 = Replace(field1, '|', '\"')";
    cmd.ExecuteNonQuery();
    

    In other words, the Replace() function may have caused problems with the older "Jet" OLEDB driver (and perhaps earlier versions of the "ACE" driver) but as of the version for Access 2010 this is no longer an issue.

提交回复
热议问题