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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

column name in select stmt from asp.net page

Status
Not open for further replies.

tek2002

Programmer
Aug 21, 2001
67
US
hi,

i get an error message from the following stmt when i run in an asp.net page - the problem is w/ the 3rd column name:

SELECT ProductID,ProductName,[Units In Stock],Desc
FROM Products

putting brackets around the 3rd column name does not help and i get an error message - i have tried single and double quotes also....for now inorder to move on, i had to exclude the colum name.

does anyone have any suggestions.

thanks a bunch
 
A quick solution is
SELECT ProductID,
ProductName,
[Units In Stock] UnitsInStock ,Desc
FROM Products

________________________________________________________________________________
If you do not like change, get out of the IT business...
 
desc is a reserved word in SQL so you should not use it as a column name.
 
Also avoid the use of spaces in column names as you then have to work with the [] around them. I would change the column name. Swamp boogie is correct, you should never use a reserved word as a column name. I'd change that one too.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top