DataTable Select

D

DaveL

how to uppercase a table columen in datatable select
//dt is a Datatable
i Need to uppercase control.text and table column data
i dont know how to set loginname to upper case
if (dt.Select("loginname='"+this.txLoginName.Text.ToUpper()+"'").Length>)
{
// Do Somthing
}

DaveL
 
R

rustylee

how to uppercase a table columen in datatable select
//dt is a Datatable
i Need to uppercase control.text and table column data
i dont know how to set loginname to upper case
if (dt.Select("loginname='"+this.txLoginName.Text.ToUpper()+"'").Length>)
{
    // Do Somthing

}

DaveL

The Select method returns an array of DataRows. It won't work in your
'if' statement.

-Rusty
 
D

DaveL

it works just fine in my if statement
I Reference the Returned array length at the end of the if

example works just fine

if (dtRows.Select("Name <>'"+txName.Text.Trim().ToUpper()+"'").Length >
0)
{
Console.WriteLine("Found");
}
else
{
Console.WriteLine("Not Found");
}
Console.ReadKey();


I still dont know how to upperCase the Name Column in the Select
DaveL




how to uppercase a table columen in datatable select
//dt is a Datatable
i Need to uppercase control.text and table column data
i dont know how to set loginname to upper case
if (dt.Select("loginname='"+this.txLoginName.Text.ToUpper()+"'").Length>)
{
// Do Somthing

}

DaveL

The Select method returns an array of DataRows. It won't work in your
'if' statement.

-Rusty
 
R

rustylee

it works just fine in my if statement
I Reference the Returned array length at the end of the if

example works just fine

    if (dtRows.Select("Name <>'"+txName.Text.Trim().ToUpper()+"'").Length >
0)
            {
                Console.WriteLine("Found");
            }
            else
            {
                Console.WriteLine("Not Found");
            }
            Console.ReadKey();

I still dont know how to upperCase the Name Column in the Select
DaveL




The Select method returns an array of DataRows.  It won't work in your
'if' statement.

-Rusty

Sorry, somehow the formattting on my display tricked my eyes. Please
accept my humble apologies.

I will assume you are querying against a database. Would it be
possible to construct the query in your code to perform the
"uppercasing" in the query:

string commandText = "SELECT UPPER(Name)...FROM..."

-Rusty
 

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