如何搜索/过滤数据库值到多个文本框(SQL / VB) [英] How to search/filter database values to multiple textbox (SQL/VB)
问题描述
我正在寻找一些解决方案,因为我想用一个文本框搜索数据库值(student_name,badge_id),所有结果将显示在多个字段中,如NAME,Roll No,Address。
基本上我会将NAME或ROLLNO放到搜索框中,它将检索与该NAME或ROLLNO相关的所有信息。
有可能吗?
我的尝试:
DIM DV As 新 DataView(dbDataSet)
DV.RowFilter = 字符串 .Format( name like'%{0}%'),search_text.Text)
student_name.Text.DataSource = DV
student_roll.text.DatSource = DV
如MSDN文档所述,您可以使用多个语句:
Quote:运营商
允许使用布尔级联AND
,或
,NOT
运营商。您可以使用括号到组子句和强制优先。AND
运算符优先于其他运算符。例如:
< pre lang =SQL>(LastName = ' Smith' OR LastName = ' Jones') AND FirstName = ' John'
< br $> b $ b
资料来源:
DataView.RowFilter属性(System.Data) [ ^ ]
DataColumn.Expression属性(System.Data) [ ^ ]
Well Im looking for some solution as I want to search database values(student_name,badge_id) with a single textbox and all the result will be shown in multiple fields like NAME, Roll No, Address.
Basically I will put the NAME or ROLLNO to search box and It will retrieve all the information related to that NAME or ROLLNO.
It it possible?
What I have tried:
DIM DV As New DataView(dbDataSet) DV.RowFilter = String.Format("name Like '%{0}%'), search_text.Text) student_name.Text.DataSource = DV student_roll.text.DatSource = DV解决方案AS MSDN documentation states, you can use multiple statements:
Quote:Operators
Concatenation is allowed using BooleanAND
,OR
, andNOT
operators. You can use parentheses to group clauses and force precedence. TheAND
operator has precedence over other operators. For example:
(LastName = 'Smith' OR LastName = 'Jones') AND FirstName = 'John'
Source:
DataView.RowFilter Property (System.Data)[^]
DataColumn.Expression Property (System.Data)[^]
这篇关于如何搜索/过滤数据库值到多个文本框(SQL / VB)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!