使用文本框过滤数据并在 vb.net 的列表视图中查看

发布于 2025-01-04 09:49:42 字数 35 浏览 0 评论 0原文

我想在列表视图中显示我在文本框中编写的结果,你能帮我吗?

I want to display the result in listview that i written in the texbox can you pls help me?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

耶耶耶 2025-01-11 09:49:42

如果您要求能够根据与您在文本框中键入的内容类似的条件进行搜索(我认为这就是您所要求的),那么请将您的 SQL 语句更改为

WHERE PatientName LIKE '%" & TextBox1.Text & "%'"

= 。问题是,只有在 = 完全匹配的情况下,您才会得到结果。 LIKE 语句将查找与输入内容相似的内容。 % 是通配符,意思是“任意数量的字符”。请注意,它适用于大多数数据库。如果它不适合您,请查找您的数据库的通配符并替换 %s。

If you are asking for the ability to search based on criteria similar to what you type in the textbox (I think that is what you are asking), then change you SQL statement to be

WHERE PatientName LIKE '%" & TextBox1.Text & "%'"

instead of =. The problem is that you will only get results back on the = if it matches exactly. The LIKE statement will find things similar to what is entered. THe % is a wildcard character meaning "any number of characters". Note that it will work for MOST dbs. If it does not work for you, look up wildcard characters for your db and replace the %s.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文