Search in the DataTable
-
Hi, How can i search in all columns of a table for a word that the user types in a textbox? some code pls? :doh:
-
Hi, How can i search in all columns of a table for a word that the user types in a textbox? some code pls? :doh:
DataTable
have aSelect()
method which allows you to filterDataTable
and returnsDataRow
array.All C# applications should call Application.Quit(); in the beginning to avoid any .NET problems.- Unclyclopedia My Website | Ask smart questions
-
Hi, How can i search in all columns of a table for a word that the user types in a textbox? some code pls? :doh:
Aproximately: ... DataTable dt = ... string sText = txtInput.Text; foreach(datacolumn in dt.columns) { if( typeof(datacolumn) == string ) { DataRow[] oRows = dt.Select(DataColumn.Name + " = " + sText); if( oRows.Count > 0 ) { //Do wat you have to do } } }
Visit my blog at http://dotnetforeveryone.blogspot.com