DataContext.ExecuteCommand("DELETE from Table WHERE Date < Now()");
I get an error about how Now() is not a recogn开发者_如何转开发ized built in function name.
When you send your SQL query directly to SQL Server, you need to use the SQL Server functions - not the .NET ones.
Use this instead:
DataContext.ExecuteCommand("DELETE from Table WHERE Date < GETDATE()");
GETDATE()
is the T-SQL equivalent for Now()
Now() is not TSQL. Use GETDATE() or GETUTCDATE()
Could that be GetDate()
instead of Now()
?
You should use GETDATE()
instead of NOW()
I don't think Now() is a recognized function in SQL.
精彩评论