Error in select statement in C# code.
Hello Friends,
Rite now i am developing an application for maintaining employee login,logout information.
I am using a select statement where the condition is userid & systemtime.
below is the code.
sqlcommand="SELECT timein1,curstatus FROM report WHERE userid=" + userID;
sqlcommand += " and [date1]=";
sqlcommand+=System.DateTime.Today;
commandSelect.CommandText = sqlcommand;
readerSelect = commandSelect.ExecuteReader(CommandBehavior.CloseConnection);
This is the exception iam getting.
Regards,
moon0315
ex = {"Syntax error (missing operator) in query expression 'userid=31 and [date1]=6/13/2009 12:00:00 AM'."}
I have spent almost 7 hrs in figuring out the error.but no use.
i guess the error is in system.datetime.today;
Rite now i am clueless..
It would be so great if some one helps me...
Pls help me..