Access 数据库在 C# 中选择多行
我一直在关注这个网站,以 C#
http://www.homeandlearn 实现基本的 Access 数据库。 co.uk/csharp/csharp_s12p12.html
我想搜索不止一行。此代码适用于一行。
string searchFor = txtFurniture.Text;
returnedRows = ds1.Tables["Furniture"].Select("Finish='" + searchFor + "'");
如何添加额外的行进行检查?我尝试过类似的方法,
returnedRows = ds1.Tables["Furniture"].Select("Finish='" + "Style='" + searchFor + "'");
但失败了。
I have been following this site for basic Access database implementation in C#
http://www.homeandlearn.co.uk/csharp/csharp_s12p12.html
I want to search more than one row. This code works for one row.
string searchFor = txtFurniture.Text;
returnedRows = ds1.Tables["Furniture"].Select("Finish='" + searchFor + "'");
How do I add in additional rows to check? I have tried something like
returnedRows = ds1.Tables["Furniture"].Select("Finish='" + "Style='" + searchFor + "'");
but this fails.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
正如DataTable.Select 方法的文档中所引用的,DataColumn.Expression 属性的文档 描述了与
filterExpression
参数。在您的情况下,使用And
创建具有两个条件的复合表达式:...或更易读...
As referenced in the documentation for the DataTable.Select method, the documentation for the DataColumn.Expression property describes the syntax to be used with the
filterExpression
parameter. In your case, useAnd
to create a compound expression with your two conditions:...or more readably...
您需要添加和条件
另外您可以检查这个答案可能会帮助您轻松理解: Datatable select具有多个条件
you need to add and condition
In addition you can check this answer might help you to understand easily : Datatable select with multiple conditions
您的意思是要检查的附加字段。
创建一个如下所示的条件:
使用:
You mean an additional field to check.
Make a condition that looks like this:
using: