如何创建搜索框 [英] How to create a search box

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

问题描述

嗨!我是asp.net的新手,我想创建一个搜索框,可以搜索甚至类似的单词。在我的数据库中有名字,姓氏和位置。当我输入a并提交然后在数据网格视图中显示所有a包括数据库中的名称和位置。



感谢您宝贵的时间!

Hi! I am new to asp.net and I want to create a search box which can search even similar words.In my database there first name ,last name and location. When I typed "a" and submit then show all "a" include names and locations from database in data grid view.

Thanks for your precious time!

推荐答案

检查:



从数据库中搜索记录并在gridview中显示 [ ^ ]


将搜索输入转换为变量并单击搜索按钮执行选择查询。

Take the search input into a variable and execute select query on click on Search button.
eg. String input ="abc"; // or TextBox1.Text



您的查询将如下所示:


Your query will look like :

String SqlQuery = "Select * from TableName where firstName like '%"+ input + "%' or lastName like '%"+ input + "%' or Location like '%"+ input + "%'";


http://www.aspdotnet-suresh.com/2012/02/jquery-display-auto-complete-search.html [< a href =http://www.aspdotnet-suresh.com/2012/02/jquery-display-auto-complete-search.htmltarget =_ blanktitle =New Window> ^ ]





记住你需要学习一些JQuery的东西。这类问题会用.......
http://www.aspdotnet-suresh.com/2012/02/jquery-display-auto-complete-search.html[^]


remember one thing you need to learn some JQuery.this type of problems will be solved in very easy way with that.......

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

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