Searching in a dataset

  • Thread starter Thread starter Mojtaba Faridzad
  • Start date Start date
M

Mojtaba Faridzad

Hi,

I don't know how I can search in a dataset. I can trace the table by DataRow
and foreach loop. but you may know a better way. I have a datagrid and a
textbox. when user type a string in textbox, I need to search in datagird
and change the current record to the found record.

thanks
 
You really want to search a particular column in your table, right. use
DataTable Search method, this allows you to pass a filter.
Sometimes it is good to read MSDN.

Good Luck.
 
You can convert your dataset into XML and then use XQuery to search
through the xml. I'm not sure that it is actually faster though
because if you are doing frequent Selects from the database instead of
just "caching" the result into the memory, then its definately not
fast.
Sushant
 
Hi there,

I looked into MSDN and I found "DefaultView" and "Compare" which help to do
a search in DataTable. but I am looking for something else. I don't want to
filterize my DataTable. I want to keep the same table just change the
current record. I used to work with Foxpro and in that language we had
"seek" or "locate" command which helped me to find a record in a table. do
we have a method like them in DataTable?

thanks again
 
thanks Sandman. I checked LoadDataRow method. this method searchs for a row,
if not found, adds it. I don't want to add a new row. I'd like to do a
search base on a column.
 
Back
Top