In a SELECT
command to my SQL Server 2005 database, I need to convert the OrderDelDateTime
column (which is in datetime
format) to a date format so that I can select all rows with today's date, regardless of the time.
Here is what I've got:
cmd = New Data.SqlClient.SqlCommand("SELECT * FROM [Orders] where [OrderDelDateTime] = '" + Now.Date + "'", conn)
Obviously this returns zero results because 11/30/2012 5:30:00 PM
(in db) doesn't equal Now.Date
(11/30/2012
).
I'm using VB.Net.