473,385 Members | 1,343 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 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 5755
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: randy | last post by:
Hello all, I have a DataTable which I am building column by column and adding rows after each new column. The DataTable columns match the columns in my database table. I'm building the...
5
by: Stefan Turalski \(stic\) | last post by:
Hi, I'm wondering if there is a way to send a method parametrs by ref when DataTabel is a type of this value ? I done some sort of select over DataTable columns, just by removing them froma...
3
by: nandan | last post by:
Hi, Has any one ever compared the performance of calling a DataTable's Select method with a stored procedure doing the same thing? My point is: dataRows = DataTable.Select(filter) is better or...
4
by: Kris Rudin | last post by:
I am displaying a table of information on a web page, using an asp:table that I populate dynamically. On this page I give the user the options to group the rows by certain fields, and/or filter the...
0
by: Chris Ericoli | last post by:
Hi, I am working with an 'in session' ado dataset with an asp.net application. My dataset is comprised of two tables, one of which maintains a few calculated datacolumns. For some reason these...
2
by: JohnR | last post by:
Sorry if this is has an obvious answer, but I can't find it... I am using a datatable.select to obtain the rows in a datatable that meet certain criteria. My question is this: for each of the...
7
by: wk6pack | last post by:
Hi, How do I check datatable.select(filter) in the following: for each dtrow in datatable.select(filter) .... next I've also tried:
6
by: Pete Wittig | last post by:
Hi, I have a DataTable and I want to get a subset of the rows within it. I use the Select method to get my subset and the results are in a DataRow. I want to put those Rows back into a...
1
by: Maxwell2006 | last post by:
Hi, I am working with strongly typed datatables. What is the most efficient way to build a new DataTAble based on the result of DataTable.Select? At this point I use a foreach loop to do the...
6
by: fniles | last post by:
I am using VB.NET 2005 and Access database. My program uses a timer that kicks in every 1 min to read from a database and copy the dataset table to a datatable. This database is in a class called...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
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 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.