从C#.net调用Ms Access Query时出现问题 [英] Problem while calling Ms Access Query from C# .net

查看:78
本文介绍了从C#.net调用Ms Access Query时出现问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




有人请帮助我吗?


我有一个包含1个Tabel和2个查询的MS Access数据库。 />
例如


Tabel" client" ;:包含字段名称,地址,城市,州,ziip的客户

query1 allClient:从客户端选择*;

query2" SelectedClient" ;:从客户端选择*,其中名称为''%ab%'';


我在使用c#.net开发的应用程序中使用此数据库。


当我正在阅读表格客户时或query1" allClient"通过OleDbDataReader,它工作得很好。


但是当我使用与query2selectedClient相同的方式时虽然查询结果中有一些记录,但datareader是空的。查询在MS Access中工作得很好,但在我的应用程序中却没有。


谢谢,

Rajesh

Hi,

Will anybody please help me?

I have a MS Access Database with 1 Tabel and 2 queries.
e.g.

Tabel "client": Client containing fields name,address,city,state,ziip

query1 "allClient": Select * from client;
query2 "SelectedClient": Select * from client where name Like ''%ab%'';

And I am using this database from my application developed in c# .net.

When I am reading table "Client" or query1 "allClient" through OleDbDataReader it''s working perfectly.

But when I am using the same way with query2 "selectedClient" the datareader is empty eventhough there are some records in query result. The query is working nice in MS Access but not in my application.

Thanks,
Rajesh

推荐答案

按如下方式更改query2:


query2" SelectedClient" ;:从客户端选择*,其名称为''* ab *'';


访问中的通配符是*。不是%
Change query2 as follows:

query2 "SelectedClient": Select * from client where name Like ''*ab*'';

The wildcard in access is "*" not "%"



按如下方式更改query2:


query2" SelectedClient" ;:从客户端选择*其中名称为''* ab *'';


访问中的通配符为*不是%
Change query2 as follows:

query2 "SelectedClient": Select * from client where name Like ''*ab*'';

The wildcard in access is "*" not "%"



你好mmccarthy,


我也试过''* ab *''但它仍然无法正常工作...

当我在MS Access中运行时,它的工作非常好......

例如Access" SelectedClient"中存在查询。 :从客户端选择*,其中名称为''* ab *'';


我再次从c#.net运行查询从SelectClient选择FName,LName它不起作用......


你能帮帮我吗?


问候,

Rajesh


Hi mmccarthy,

I tried like ''*ab*'' also but it''s still not working...
When i am running in MS Access it''s working very nice..
e.g. There is a query in Access "SelectedClient" : Select * from client where name Like ''*ab*'';

And again i am running query from c# .net "Select FName,LName from SelectedClient" and it''s not working...

would you please help me?

Regards,
Rajesh


如果它在Access中工作,你的问题可能在C#中。我会看看能不能让别人看一下。
If it works in Access your problem is probably in C#. I''ll see if I can get someone to look at it.


这篇关于从C#.net调用Ms Access Query时出现问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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