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 3 1290
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
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
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 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Brian Brane |
last post by:
I have properties that wrap DataRow columns as in:
public int aNumber
{ get{ return m_DataRow; }
set{ m_DataRow = value; } }
If the column happens to contain DBNull, I get a cast
exception...
|
by: Chet |
last post by:
I have a DataRow from a table in a data set. One of the columns has a
name of "COMPANY_TICKET_ID" and I'm trying to get this column's value
with the following:
foreach( DataRow row in...
|
by: Manish |
last post by:
Hey Guys
I am using a datagrid to extract information out of SQL Server
datbase. The fields extracted are category,week,budget,Last
Year,Forecast and Projection. Also i add a calculated column...
|
by: Gene Hubert |
last post by:
I'm using DataTable.ImportRow to move data from one datatable to
another...
Dim dt, dtTarget As DataTable
Dim dr As DataRow
dt = DirectCast(Me.DataSource, DataTable)
dtTarget = dt.Clone...
|
by: JohnR |
last post by:
I have a datatable as the datasource to a datagrid. The datagrid has a
datagridtablestyle defined. I use the datagridtablestyle to change the
order of the columns (so they can be different than...
|
by: Coleen |
last post by:
Hi all :-)
I have a datatable that I need to clone completely except for 1 column - I
need to replace the contents of this 1 column with the contents from another
datatable that has the exact...
|
by: Leeor Chernov |
last post by:
Hi ,
I am using the method:
DSSap.ReadXml( XmlPath,XmlReadMode.InferSchema );
And as I expected I get an error when the xml does not matching my DataSet that contains already a schema ,
The...
|
by: webmaster |
last post by:
Pardon my not knowing where to find this one... but try finding the
meaning of "this" on the net or in reference books.
I'm trying to follow this example from Apress book - Introduction to
C#...
|
by: majidkorai |
last post by:
Hey
Guyz I am having problem when i read the data from a datareader into a data table.
The whole scenario is this that I want to read data from two diffrent databases, the table strcutre is...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
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...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |