如何搜索提供部分名称的Emp详细信息? [英] How Do I Search Emp Details Providing Partial Name?

查看:62
本文介绍了如何搜索提供部分名称的Emp详细信息?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我使用winforms(C#)来开发组织的员工详细信息。我已经将groupbox用于具有ID和名称的搜索条件。如果我提供完整的名字和搜索,我能够获得详细信息。但我的问题是只根据给定的名称(不是全名)显示所有名称。例如,当我给Da时我文本框应该显示所有以Da(大卫,丹尼尔等)开头的名字。



愿任何人帮助我。

解决方案

您可以使用like运算符,如解决方案1中所示。



如果您想建议追加文本框,请参阅下面的文章...



从数据库中自动提供TextBox Windows窗体中的列 [ ^ ]


通常第三方WinForm控件处理部分搜索,如果没有,则可以:



1)如果您正在使用数据库,然后在上使用%运算符进行查询,例如 select * from tablename where column like'%da%'

2)如果你有内存集合,那么使用循环或LINQ和字符串比较包含() stringvalue.Contains( DA);

Hi,
i am using winforms(C#) for developing employee details of an organization. I have used groupbox for search criteria which has ID and name. I am able to get the details if i provide whole of first name and search.But my problem is to get all the names displayed based on only part of name given(not whole name).For example, when i give "Da" i textbox all the names starting with Da(david,daniel etc)should be displayed.

May anyone pls help me.

解决方案

You can use like operator as demonstrated in solution 1.

If you want suggest append textbox then see below Article...

Autosuggest TextBox from database column in Windows Forms[^]


Usually the 3rd party WinForm controls handle partial searching for you, if not then you can:

1) If you are using a database, then query by using a % operator on a like : select * from tablename where column like '%da%'
2) If you have in memory collections then use a loop or LINQ and string compare with Contains(): stringvalue.Contains("da");


这篇关于如何搜索提供部分名称的Emp详细信息?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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