471,338 Members | 1,304 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

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

DataTable Select

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.ToU pper()+"'").Length>)
{
// Do Somthing
}

DaveL

Sep 15 '08 #1
4 5530
On Sep 15, 11:21*am, "DaveL" <dvs_...@sbcglobal.netwrote:
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.ToU pper()+"'").Length>)
{
* * // Do Somthing

}

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

-Rusty
Sep 15 '08 #2
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


"rustylee" <ru************@gmail.comwrote in message
news:bb**********************************@b30g2000 prf.googlegroups.com...
On Sep 15, 11:21 am, "DaveL" <dvs_...@sbcglobal.netwrote:
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.ToU pper()+"'").Length>)
{
// Do Somthing

}

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

-Rusty
Sep 15 '08 #3
On Sep 15, 12:10*pm, "DaveL" <dvs_...@sbcglobal.netwrote:
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

"rustylee" <rusty.lee.2...@gmail.comwrote in message

news:bb**********************************@b30g2000 prf.googlegroups.com...
On Sep 15, 11:21 am, "DaveL" <dvs_...@sbcglobal.netwrote:
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.ToU pper()+"'").Length>)
{
// Do Somthing
}
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
Sep 15 '08 #4
Thats what i'll have to do, if i can't figure out how to
uppercase the column in the Datatable object

Making a trip back to the database is prob a better idea

Thanks
DaveL
Ps. No worries , i see stuff not there or there all the time
thanks again

"rustylee" <ru************@gmail.comwrote in message
news:64**********************************@i20g2000 prf.googlegroups.com...
On Sep 15, 12:10 pm, "DaveL" <dvs_...@sbcglobal.netwrote:
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

"rustylee" <rusty.lee.2...@gmail.comwrote in message

news:bb**********************************@b30g2000 prf.googlegroups.com...
On Sep 15, 11:21 am, "DaveL" <dvs_...@sbcglobal.netwrote:
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.ToU pper()+"'").Length>)
{
// Do Somthing
}
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
Sep 15 '08 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Kris Rudin | last post: by
reply views Thread by Chris Ericoli | last post: by
7 posts views Thread by wk6pack | last post: by
6 posts views Thread by Pete Wittig | last post: by
6 posts views Thread by fniles | 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.