访问查询中未定义的函数替换 [英] Undefined Function Replace In Access Query

查看:82
本文介绍了访问查询中未定义的函数替换的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我在访问查询中使用替换函数时它工作正常,但是当我在我的vb.net程序中执行此查询时,它显示错误未定义函数替换。



这里是一个查询:

When I use replace function in access query it work fine but when I execute this query in my vb.net program it show error undefined function replace.

Here Is a Query :

SELECT ShopMaster.ShopId, ShopMaster.ShopName, Replace(ShopName,' ','') AS SearchShopName FROM ShopMaster





此查询可以正常访问,但不能通过我的vb.net程序。



我正在使用vb。 net 2008和access 2007.



谢谢

Rohit Sharma



This query work fine in access but not through my vb.net program.

I am using vb.net 2008 and access 2007.

Thanks
Rohit Sharma

推荐答案

啊。访问。



我相信你无法在MS Access之外执行此操作。 VB.Net 2008是否具有 Replace()函数,如果是,您是否正确使用它?我没有使用VB.Net进行编程所以这就是我要问的原因。


请注意:当您在访问中进行操作时访问非常有用但是它是一个非常硬的数据库,作为VB,C#等的后端工作......





我发现SQL Server( Express)作为我的后端,Access作为我的前端运行良好,减少了使用MS Access作为后端时所带来的麻烦。
Ah. Access.

I believe you will not be able to do this outside of MS Access. Does VB.Net 2008 have the Replace() function and if so, are you using it correctly? I don't program with VB.Net so this is why I ask.

Please note: Access works great when you are doing stuff "in" Access but it is a very hard database to work with as a backend to VB, C#, etc...


I have found that SQL Server (Express) as my backend and Access as my frontend works well and reduces the headaches involved when working with MS Access as the backend.


如果您要做的就是摆脱空格,为什么不改为使用它:

If all you are trying to do is get rid of spaces, why don't you instead use this:
SELECT ShopMaster.ShopId, ShopMaster.ShopName, Trim(ShopMaster.ShopName) AS SearchShopName FROM ShopMaster





如果它不只是额外的空格,你可能想尝试使用iif而不是Replace。 (我没有使用2007访问数据库进行测试,因此我不确定它仍然可用...)





If it's not just about extra spaces, you might want to try the iif instead of Replace. (I didn't test with a 2007 access database, so I'm not sure it's still available...)

SELECT ShopMaster.ShopId, ShopMaster.ShopName, iif(ShopName,' ','') AS SearchShopName FROM ShopMaster


查询在Access中有效,因为替换函数由Access定义,而不是由Jet数据库引擎支持的有限TSQL子集定义。
The query works in Access because the Replace function is defined by Access, not by the limited subset of TSQL that the Jet database engine supports.


这篇关于访问查询中未定义的函数替换的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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