Hi guys,

I am writing some query from winforms. I am getting error with the following query:

string query = "Select [Doctor Name], Day, DateTime, Med_Sur from Doc_Pat_App where (lower([Patient Name])= '" + name + "') and (DateTime >= GetDate()))";

I know that there is no mistake till lower() function, my mistake is in DateTime >= GetDate() Comparison. Can anybody figure out how can I correct the syntax? my 'DateTime' column is of datatype 'datetime' in sql. Please don't confuse this column name with built-in one.

And one thing more that I want to just compare the date portions of both? Am I doing right or I should use Convert() Function?

I am using sql server 2005.

6 Years
Discussion Span
Last Post by great_learner

For you syntax error, I think you might have an extra ")" in

(DateTime >= GetDate()))
This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.