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.

Recommended Answers

All 2 Replies

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

(DateTime >= GetDate()))

You are right! I placed an extra ')' at the end. Thankyou so much! :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.