I am using SQL Server CE database and C# language. I have a table with a datetime
type column. I want to use a SELECT statement like
SELECT * FROM Data WHERE Date = @Date
But I need only date part of the datetime
value. So I can add parameter like
SQLCmd.Parameters.Add("@Date", date.Date);
My problem is with SELECT
statement I think.
除此之外,您可以使用DateDIFF
SELECT * FROM Data WHERE DATEDIFF(day, Date, @Date)=0
SELECT * FROM Data WHERE DAY(Date) = DAY(@Date)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.