471,317 Members | 1,339 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

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

which column in a datarow?

Hi,
I finally got a search in a datatable working (so that I can type "p", and
the first row with data beginning with a p is highlighted). I use this:
string searchThis = "p";
DataRow[] dr = tCat.Select("Customer LIKE'" + searchThis + "*'");
My problem is that I need to specify which column to search in. The way it
is now, if something starts with a p in the first column, it will highlight
the row. (I need to search one of four columns.) Is there any way to
determine which column the matched string was found in?
Thanks again so much!
Mel
Dec 7 '05 #1
3 1181
The Select function does a search on a column. It's very similar to the
'WHERE' clause in your select statement.
Cheers,
Mark

"melanieab" wrote:
Hi,
I finally got a search in a datatable working (so that I can type "p", and
the first row with data beginning with a p is highlighted). I use this:
string searchThis = "p";
DataRow[] dr = tCat.Select("Customer LIKE'" + searchThis + "*'");
My problem is that I need to specify which column to search in. The way it
is now, if something starts with a p in the first column, it will highlight
the row. (I need to search one of four columns.) Is there any way to
determine which column the matched string was found in?
Thanks again so much!
Mel

Dec 7 '05 #2
So should this be enough to say to search in the column called Customer?

DataRow[] dr = tCat.Select("Customer LIKE'" + searchThis + "*'","Customer
ASC");

Thanks again,
Mel
"Mark" wrote:
The Select function does a search on a column. It's very similar to the
'WHERE' clause in your select statement.
Cheers,
Mark

"melanieab" wrote:
Hi,
I finally got a search in a datatable working (so that I can type "p", and
the first row with data beginning with a p is highlighted). I use this:
string searchThis = "p";
DataRow[] dr = tCat.Select("Customer LIKE'" + searchThis + "*'");
My problem is that I need to specify which column to search in. The way it
is now, if something starts with a p in the first column, it will highlight
the row. (I need to search one of four columns.) Is there any way to
determine which column the matched string was found in?
Thanks again so much!
Mel

Dec 7 '05 #3
Yes, take a look at MSDN for DataTable.Select.

Cheers,
Mark

"melanieab" wrote:
So should this be enough to say to search in the column called Customer?

DataRow[] dr = tCat.Select("Customer LIKE'" + searchThis + "*'","Customer
ASC");

Thanks again,
Mel
"Mark" wrote:
The Select function does a search on a column. It's very similar to the
'WHERE' clause in your select statement.
Cheers,
Mark

"melanieab" wrote:
Hi,
I finally got a search in a datatable working (so that I can type "p", and
the first row with data beginning with a p is highlighted). I use this:
string searchThis = "p";
DataRow[] dr = tCat.Select("Customer LIKE'" + searchThis + "*'");
My problem is that I need to specify which column to search in. The way it
is now, if something starts with a p in the first column, it will highlight
the row. (I need to search one of four columns.) Is there any way to
determine which column the matched string was found in?
Thanks again so much!
Mel

Dec 7 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Chet | last post: by
3 posts views Thread by Gene Hubert | last post: by
reply views Thread by rosydwin | last post: by

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.