在sql server中以字典顺序获取数据 [英] Get data in dictionary order in sql server

查看:285
本文介绍了在sql server中以字典顺序获取数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好b $ b

我的数据库表有一列,其中包含所有员工姓名,我的UI包含一个文本框和一个列表框。



我的要求是当我在文本框中输入一个字符时,数据库表中该字符的匹配名称应该在列表框中提取并列出。



例如:数据库表:praful,sathish,gajendra,elephant



假设我在文本框中输入了一个字母a然后



我想要的:gajendra,sathish,praful,elephant



请建议我怎么做



谢谢

Prafulla

Hi
My database table has one column which has all the employee names and my UI contain one textbox and one listbox.

My requirement is when I will input one character into the textbox the matching names of that character from the database table should extract and listed inside the listbox.

Ex: database table : praful,sathish,gajendra,elephant

suppose I am entering a letter "a" inside the textbox then

What I want: gajendra,sathish,praful,elephant

Please suggest me how would I do that

Thanks
Prafulla

推荐答案

尝试:

Try:
SELECT username FROM MyTABLE WHERE userName LIKE '%a% ORDER BY userName ASC


文本框的OnKeyUp事件需要关注



清除列表框。

使用类似运算符的sql从数据库中获取匹配的名称(在sql中传递文本框值)。

使用名称填充列表框从数据库返回。
OnKeyUp event of textbox you need to do following

Clear your listbox.
Get matching names from database using sql like operator (pass textbox value in your sql).
Fill your listbox with names returned from database.


这篇关于在sql server中以字典顺序获取数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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