在EX pression未定义功能“替换” [英] Undefined function 'Replace' in expression

查看:151
本文介绍了在EX pression未定义功能“替换”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个VB.Net应用。我有一个MS Access数据库的连接。现在,我必须执行一个查询。我的查询是:更新目录一组字段1 =更换(字段1,'|','')

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,'|','"')

该查询似乎很好地工作,从Access数据库的查询分析器,但是当我做同样的形式VB.Net code它将引发我一个错误,说明在EX pression未定义的函数替换

This query seems to work fine from the query analyzer of the Access database but when I do the same form the VB.Net code it throws me an error stating "Undefined function 'Replace' in expression"

我使用OLEDB连接和命令。我现在用的的ExecuteNonQuery功能。

I am using OLEDB connection and command. I am using the "executenonquery" feature.

任何一个可以帮助我吗?

Can any one help me?

推荐答案

不幸的是,当你不使用Access查询引擎都从您连接到Access数据库VB.Net应用程序。您正在使用Jet。一些在Access中您可以使用的功能(如替换)不在喷用。

Unfortunately when you connect to an Access database from you VB.Net application you aren't using the Access query engine at all. You're using Jet. Some of the functions available to you in Access (such as Replace) aren't available in Jet.

传统的解决方案是使用相结合的 IIF INSTR 等(这些的可用)。是的,它不是像你一样有替换一起玩,但你必须要学会做没有。

The classic solution is to use a combination of Iif, Instr etc (those are available). Yep, it's not as nice as having Replace to play with but you'll have to learn to do without.

这篇关于在EX pression未定义功能“替换”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆