doramail05
asked on
Incorrect syntax near '12'. at DateTime.Today.Date
i have this incorrect syntax
'Incorrect syntax near '12'.'
where the so_order_date is 7/17/2009 12:00:00 AM in SQL Server 2005
'Incorrect syntax near '12'.'
where the so_order_date is 7/17/2009 12:00:00 AM in SQL Server 2005
string sqlcmddual2 = "USE " + txtProntoDB.Text + "; Select * FROM sales_order WHERE so_bo_suffix = '' AND LEFT(so_order_no, 3) = 356 AND so_order_date =" + DateTime.Today.Date;
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
1) using dynamic sql, calling for sql injection
2) not using bind paramters and at the same time no explicit data type conversion (check up CONVERT() function ....)
3) date = date ... I presume the so_order_date might have some time portion stored?
if so, that sql will never return anything. you must use so_order_date >= {date} and so_order_date < dateadd(day, 1, {date} )