列表视图搜索 [英] Listview search

查看:62
本文介绍了列表视图搜索的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的代码


选择Case Me.Text

案例供应商管理"
如果Me.cboSearch.Text =供应商ID",则

xSQL ="SELECT *从供应商那里,那里的SuppliersID类似"&Me.txtSearch.Text和""
LoadSuppliers(xSQL)


搜索的结果将显示在列表视图中,我想要的是,如果我搜索的内容没有任何值,则提示消息将显示该错误,而不显示我该怎么做?

this is my code


Select Case Me.Text

Case "Suppliers Management"
If Me.cboSearch.Text = "Supplier ID" Then

xSQL = "SELECT * FROM suppliers WHERE SuppliersID LIKE ''" & Me.txtSearch.Text & "''"
LoadSuppliers(xSQL)


the result of that search would display in the listview what I want is that if there is no value for what I''m searching for then a prompt message would display that error no display how am I going to do that?

推荐答案

您是否要我们提供执行此操作的所有代码?

希望不会,因为那可能不会发生.但是我们可以为您提供一些技巧和伪代码.

您将要首先使用ADO.NET.有许多不同的类型,但是SqlAdapter可能是您最好的选择.您可以使用SqlDataReader类获取查询结果.然后,拉出所需的信息,并将其显示在ListView中.另外,如果您使用LIKE关键字,是否不想包含通配符?还是您的txtSearch已经用通配符写了?
Are you asking us to give you all of the code to do that?

Hopefully not, because that''s probably not going to happen. But we can give you some tips and pseudo-code.

You''ll want to use ADO.NET first. There are many different types, but the SqlAdapter will probably be your best bet. You can use the SqlDataReader class to get the results of your query. Then, pull out the information you need and display it in the ListView. Also, if you''re using the LIKE keyword, don''t you want to include wildcards? Or is your txtSearch already written with the wildcards?


这篇关于列表视图搜索的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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