使用文本框从DataGridView和SQLite数据库中过滤。 [英] Using a Textbox to filter from DataGridView and SQLite Database.

查看:75
本文介绍了使用文本框从DataGridView和SQLite数据库中过滤。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嘿所有,

我正在尝试在我的程序中获得更多用户友好的东西。现在我正在尝试通过键入文本框进行过滤,它会过滤到您正在键入的内容并显示整行。


这就是我目前所拥有的:

Hey all,
I''m trying to get some more user friendly things in my program done. Now I''m trying to filter by typing in a text box and it filters to what you are typing and shows the entire row.

This is what I currently have:

展开 | 选择 | Wrap | 行号

推荐答案

由于涉及的开销,每次按键时我都不会打开你的数据库。相反,我会对您的数据使用select语句或设置View rowfilter。您更新的代码不必要地创建一个视图,打开一个连接,并设置'行过滤器,但它从未分配给您的DataGridView。你可以选择一行代码:
I wouldn''t open your db every time a keypress has been made due to the overhead involved. Instead I would either use a select statement on your data or set your View rowfilter. Your updated code unnecessarily creates a view, opens a connection, and set''s the row filter but it''s never assigned to your DataGridView. You should be fine with one line of code in there instead:
展开 | 选择 | Wrap | 行号


当我使用那行代码时,它可以找不到RowFilter。 rror消息基本上说DataGridView没有包含RowFilter的定义。

所以我稍微改了一下
When I use that line of code, it can''t find RowFilter. The rror message basically says that DataGridView doesn''t contain a definition for RowFilter.
so I changed it a little bit
展开 | 选择 | Wrap | 行号


我的触发器有点快......
I was a little quick on the trigger....
展开 | 选择 | Wrap | 行号


这篇关于使用文本框从DataGridView和SQLite数据库中过滤。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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