473,387 Members | 3,787 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Searching in a dataset

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
Nov 16 '05 #1
8 3463
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" <mf*******@hotmail.com> wrote in message
news:u6**************@tk2msftngp13.phx.gbl...
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

Nov 16 '05 #2
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" <mf*******@hotmail.com> wrote in message news:<u6**************@tk2msftngp13.phx.gbl>...
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

Nov 16 '05 #3
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" <Lo******@MSN.com> wrote in message
news:ON**************@tk2msftngp13.phx.gbl...
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" <mf*******@hotmail.com> wrote in message
news:u6**************@tk2msftngp13.phx.gbl...
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


Nov 16 '05 #4
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" <Lo******@MSN.com> wrote in message
news:ON**************@tk2msftngp13.phx.gbl...
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" <mf*******@hotmail.com> wrote in message
news:u6**************@tk2msftngp13.phx.gbl...
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


Nov 16 '05 #5
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!
Nov 16 '05 #6
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!
Nov 16 '05 #7
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" <an*******@devdex.com> wrote in message
news:uC**************@TK2MSFTNGP09.phx.gbl...
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!

Nov 16 '05 #8
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" <an*******@devdex.com> wrote in message
news:uC**************@TK2MSFTNGP09.phx.gbl...
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!

Nov 16 '05 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Mario Rodriguez | last post by:
Hi I am trying to search activeDirectory through OLEDB and I am getting the exception like this DB_E_NOTABLE(0x80040E37) at OleDbDataAdapter.Fill method. My code look like this. ...
1
by: David | last post by:
Hello, I use the VS .NET 2003. Say I have a Windows form (with C# code, of course) which is connected to a database to one table. I can browse through the records, but I don't know how to...
5
by: David Wender | last post by:
I want to create a dataview with a sort on multiple columns. However, when I use FindRows, I only want to search some of the columns, not all. Is this possible? I have not been able to make it...
33
by: Geoff Jones | last post by:
Hiya I have a DataTable containing thousands of records. Each record has a primary key field called "ID" and another field called "PRODUCT" I want to retrieve the rows that satisy the following...
0
by: Peter Newman | last post by:
VB.Net 2003 & SQL2005 Ive been trying to find a way to search a Dataset for a value in a colum then move the currency manager to that row ? ie search for "211001" in the Column "Licence" ...
0
by: Muhammad Shoaib | last post by:
Hello Everybody! I'm using vb.net 2005 and MSSQL Server 2000 as back end i have little problem while i want to show only the data which i want, it gievs me problem infact i want to place a select...
5
by: Gowri | last post by:
Hello, I've been reading about ElementTreee and ElementPath so I could use them to find the right elements in the DOM. Unfortunately neither of these seem to offer XPath like capabilities where...
2
by: dibblm | last post by:
I'll start this hopefully simple and add code where needed or requested. Im using a combobox that bound to a DataSet. The Dataset retreives it's values from SQL. I can retreive the values...
1
by: gobblegob | last post by:
Hello Folks, I am searching a XML file for <Asset_Number> and then adding all children to DataGridView1, i can search but i dont know how to add item to the DataGridView Also my datagridview...
0
by: PeterSummer | last post by:
Could someone answer a vb.net database question? what is a good way to code a form so that a user could navigate through a dataset ie: MoveFirst, MoveNext, MovePrevious, MoveLast, Update and...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.