Groups > Asp .Net > Data Access and ObjectDataSource Control > Re: How do we search all columns in a filled DataSet?




How do we search all columns in a filled DataSet?

How do we search all columns in a filled DataSet?
Tue, 1 Apr 2008 11:29:06 +0000
Hi guys,

Can anyone provide some details as how to search in a dataset that is filled
with the data from a table. How do we use a search query like a select * from
type to search in the dataset to retrieve the data from any row of the DataSet
and not in a particular column of the DataSet?
Post Reply
Re: How do we search all columns in a filled DataSet?
Tue, 1 Apr 2008 17:29:10 +0000
I don't know are there any library functions to achieve this. But by looping all
the rows and columns we cando that i think. 

 DataTable dt = newDataTable();

DataTable dtDest = dt.Clone();for (int vLoop = 0; vLoop < dt.Rows.Count;
vLoop++)

{for (int vLoop1 = 0; vLoop1 < dt.Columns.Count; vLoop1++)

{if ((Convert.ToString(dt.Rows[vLoop][vLoop1])).IndexOf("your search
String") > 0)

{ 

dtDest.Rows.Add(dt.Rows[vLoop]);

}

}

}

finally dtDEst isThemeableAttributeTable with The rows that matched
Post Reply
Re: How do we search all columns in a filled DataSet?
Thu, 3 Apr 2008 05:21:16 +0000
Thanks, I got an idea of how to do this.
Post Reply
about | contact