Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Upper

Status
Not open for further replies.

chidi

Technical User
Mar 24, 2003
42
0
0
NG
In sql server, you can select UPPER(tablename.fieldname)
from your tablename.
But how do I make it work within asp?
I keep getting error:
Item cannot be found in the collection corresponding to the requested name or ordinal.
thx
 
redapple is right in that UCase is the function to display a string in upper case. However, your error means that you are referencing a field that does not exist in your recordset. Check to make sure that you don't have a type in your field name. Mighty :)
 
When I remove the UCASE(), my code works.
select UCASE(engineName)
FROM Engine
I keep getting this:
SQL Server]'UCASE' is not a recognized function name.
 
chidi,
Mighty is right. The error message indicates the field you are retrieving does not exist. There is nothing wrong by using Upper in your SQL statement.

To test it: just delete the Upper function and retrieve the same field, you will get the same error.

My suggestion is go back and check the validity of the field name.

Redapple
 
Let's be clear :
- UPPER is the function to use is SQL
- Ucase is the VB function
exemple :
Code:
Sql = "SELECT * FROM tableName Where UPPER(Name) = '" & ucase(myNameVar) & "';"
Water is not bad as soon as it stays out human body ;-)
 
Targol and my other good helpers, I understand what you are saying.
I have used upper in sql and have used ucase in asp but the problem I am having is that ucase is not working the way I am using it.
I am not using in my where clause.
A user enters values of either yes or no but the problem is they can either yes or YES just as they can enter no or NO.
What I want to do is to make sure that whether they enter the values in either uppercase or lowercase, that my asp captures that simply because of the way I code the asp.
Right, Targol's suggestion is not working because I am not using a where clause, I am only saying select ucase(field) from table.
Finally, I like I said in my previous thread, when I remove the ucase, my code works fine.
I am just wandering if there is a way to set sql database to convert every entry to uppercase.
I have not gotten any response from sql server forum.
 
One thing you can do if your column containing your "yes/no" value is string type (let's imagine it's name is "YesNo") is to create a new column in the same table (that you'll call "UpperYesNo" for exemple) with "UPPER([YesNo])" in it's "formula" property. Each time you'll add a value in the "yesNo" column, the upper value of it will be added to the "UpperYesNo" column. Then, in your queries, call "UpperYesNo" instead of "YesNo".
Beware that this type of field is read only. So you've got to do
Code:
INSERT INTO tableName (Yesno) VALUES ('yes');
UPDATE tableName SET YesNo = 'yes';
SELECT UpperYesNo FROM tableName;
Water is not bad as soon as it stays out human body ;-)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top