DataTable Select and functions

M

munglet

In a DataTable Select() method can I wrap the column name with a sql
function like LOWER()? The manner in which I tried failed.

For example, the code below does a simple Select to get an array of
DataRows.

DataRow[] rows = this.dataSet.Tables["StringValues"].Select("Values =
'" + newValue + "'");

However, I want to do the query case insensitive so I tried this, but
it doesn't work:

DataRow[] rows =
this.dataSet.Tables["StringValues"].Select("Lower(Values) = '" +
newValue.ToLower() + "'");

How could I go about doing a case insensitive Select on a datatable?

Thanks.

-M
 
N

Nicholas Paldino [.NET/C# MVP]

M,

While the Select method does support some very basic expressions, that
kind of string manipulation is not supported. You will have to cycle
through the rows yourself and select the appropriate rows.

Hope this helps.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top