如何按名称搜索记录 [英] how do i Search record by name

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

问题描述

如果我在文本框中输入名称"rahul"并单击搜索按钮,然后在gridview中获得rahul的选择记录,gridview的内容来自数据库.

if i input name "rahul" in textbox and click on search button then get select record of rahul in gridview,gridview content coming from database.

推荐答案

那里是 [
There is this [^]nice article on CP. I am sure you won''t need all this functionality and can extract what you want.


从DBname中选择Name,LastName,....,其中Name =''&Me. TextBox1.Text&''
Select Name,LastName,.... from DBname where Name=''" & Me.TextBox1.Text & "''


如果您要在填充网格之前基于字符串过滤数据(此处,我假设您正在使用内联SQL查询来获取数据库中的数据)
您可以使用

类似textbox.text 方法

如果使用的是存储过程,则可以将文本作为参数传递给SP,并与Like关键字一起使用以在数据网格中获取所需的数据.
if u are looking to filter your data based on the string prior to populating the grid (Here, I am assuming that you are using inline SQL query to get the data off the database)
you can use the

Like textbox.text approach

if you are using a stored procedure, you can pass in the text as parameter to the SP and use it with the Like keyword to get required data in the datagrid.


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

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