Thursday, July 30, 2009

Can somoene please tell me what this C# error means...suggestions on fixing it would be nice too?

Query Error: Syntax error (missing operator) in query expression OWNER_TYPE WHERE ((OperatorID = '19876') AND (tbl861Data.UTILITY_ID = '19876') AND ( YEAR = '2005')) ORDER BY UTILITY_ID ASC

Can somoene please tell me what this C# error means...suggestions on fixing it would be nice too?
When YEAR is used as the name of a column, its best to put it in brackets [YEAR], since in some databases YEAR is a reserved word, typically used as a function for returning the year of a specified date:





SELECT YEAR('10/19/2007') would return the integer 2007 in SQL SERVER.





Either this is the reason for your error, or you have a badly formed SELECT clause.
Reply:This is not a C# error, it looks like a SQL error. Can we see a full example of the query you are trying to construct?
Reply:Seems like a database query error but given your name is Mr know it all. I need to see the database first before i can help. Could be due to malformed SQL command error.


No comments:

Post a Comment