Searching in a dataset
Messages   Related Types
This message was discovered on microsoft.public.dotnet.languages.csharp.

Post a new message to this list...

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

Reply to this message...
 
    
Sushant Bhatia
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

"Mojtaba Faridzad" <Click here to reveal e-mail address> wrote in message news:<Click here to reveal e-mail address>...
[Original message clipped]

Reply to this message...
 
    
Lord2702
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.

"Mojtaba Faridzad" <Click here to reveal e-mail address> wrote in message
news:Click here to reveal e-mail address...
[Original message clipped]

Reply to this message...
 
    
Mojtaba Faridzad
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

"Lord2702" <Click here to reveal e-mail address> wrote in message
news:Click here to reveal e-mail address...
[Original message clipped]

Reply to this message...
 
    
sandman
Maybe DataTable.LoadDataRow will work for you.

sandman

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Reply to this message...
 
    
Mojtaba Faridzad
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.

"sandman" <Click here to reveal e-mail address> wrote in message
news:Click here to reveal e-mail address...
[Original message clipped]

Reply to this message...
 
 
System.Data.DataRow
System.Data.DataTable




Ad
MBR BootFX
Best-of-breed application framework for .NET projects, developed by Matthew Baxter-Reynolds and MBR IT
 
 Copyright © Matthew Baxter-Reynolds 2001-2008. '.NET 247 Software Development Services' is a trading style of MBR IT Solutions Ltd.
Contact Us - Terms of Use - Privacy Policy - www.dotnet247.com