C#(OleDb):如何创建搜索框 [英] C# (OleDb): How to create a search box

查看:120
本文介绍了C#(OleDb):如何创建搜索框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



现在,我花了几个小时来尝试一些事情,在Google上搜索和阅读论坛,但找不到答案!

我需要在学校里做一个业务应用程序"作为项目,在这里我需要保持对公司客户的了解.
我正在使用Microsoft Visual C#2010 Express和Access2010.

我的问题是:

如何为应用程序创建搜索框/表单,以在访问数据库(.accdb)中搜索信息.
我想使用一个文本框,从数据库中写入一些内容,例如公司名称,然后按搜索按钮.现在,它应该写出与公司名称相关的所有信息,这些信息可以在DataGrid的数据库中找到.

也许这是一个太大的项目,所以如果有人做一个不太复杂的搜索功能来做类似的事情,我也将不胜感激.

在此先感谢!

Hi,

Now I have spent several hours trying to work something out and googling around and reading forums, but I have not found my answer!

I need to make some kind of "business application" as a project in my school, where I need to keep overview over a company''s customers.
I am using Microsoft Visual C# 2010 Express and Access 2010.

My question is:

How do I create a search box/form for an application to search for information in an access-database (.accdb).
I want to use a textbox where I write something from my database, for instance the company''s name, and the push the search button. Now it should write all the information there is connected to the company''s name, found in the database in a DataGrid.

Maybe it is too big a project, so if anyone got a less complicated search function doing something similar I would also appreciate that.

Thanks in advance!

推荐答案

,因为此类项目的安全性不是问题.
我建议您使用字符串格式或串联方式构造sql语句.
创建数据集,向其中添加表,然后将数据添加到要搜索的每个表的数据表中,然后将其绑定到网格.
since security is not an issue for such a project.
i suggest you construct an sql statement using string formatting or concatenation
create a dataset, add a table to it and append data to the datatable for each of the tables you search for and then bind it to your grid.


这篇关于C#(OleDb):如何创建搜索框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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