从中明智地搜索数据名​​称 [英] search data name wise from

查看:87
本文介绍了从中明智地搜索数据名​​称的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

想要在vb.net中明智地搜索数据名​​称的代码.
例如:
如果我写"p",那么它应该显示所有以字母"p"开头的数据


如果我写"patel A",那么它应该显示所有从"patel a"开始的名称.

want code for searching data name wise in vb.net..
e.g :
if i write "p" then it should display all data starting with letter "p"
or

if i write "patel A" then it should display all names starting from "patel a"

推荐答案

很难为您提供这么少的信息.您在搜寻什么?您是否正在从数据库中提取数据?如果是这样,您可能会使用SQL并使用LIKE关键字.看起来像这样:
It''s hard to help you with so little information. What are you searching? Are you pulling data from a database? If so, you''d probably use SQL and use the LIKE keyword. It would look something like this:
SELECT * FROM myTable WHERE name LIKE 'P%'


关键是百分号.它代表可变数量的通配符.上面的代码将从表中提取所有名称以大写字母P开头的记录.

如果要搜索DataTable对象,可以在DataTable.Select函数中执行类似的操作...此代码:


It''s the percent sign that''s the key. It stands for a variable number of wildcard characters. The above will pull all records from the table that have a name that begins with a captial P.

If you want to search a DataTable object, you can do something similar in the DataTable.Select function...this code:

dtMyDataTable.Select("name LIKE 'P%'")


将返回与您的条件匹配的DataRow对象的数组.在这种情况下,它将返回所有名称以大写字母P开头的行.

如果这不是您想要的内容,请发布有关您要搜索的内容的更多信息.并包含您到目前为止所拥有的所有代码,以便我们可以更好地看到它.


will return an array of DataRow objects that match your criteria. In this case, it will return all rows that have a name that begins with a capital P.

If this isn''t what you were looking for, please post more information about what you are searching. And include any code that you have so far so we can see it better.


这篇关于从中明智地搜索数据名​​称的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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