Got a SQL Server column
datetime, Not-Null, defaults to Getdate()
in the Linq-to-SQL (.dbml
) model.
For the property in the table
Autogenerated Value is true
and auto-sync: OnInsert()
On insert in C#, the default value (current date) is automatically inserted in the table(C# no values are passed)
While updating, if I update the value to current date it doesn't update.
However if I change the
Autogenerated Value is false
and auto-sync: never
Update works (but i need a pass a value through c#)but insert fails with SQL Server overflow error because no values are passed from clientside c# to sql server
Is there any easy way to update the column value with default value?
The only solution I know is to keep the property
Autogenerated Value is false
and auto-sync: never
and to pass the current date to SQL Server on Insert? I'm currently using so many default values in SQL Server. I don't want to pass default values on insert from server side.
What I want to achieve is send no values on inserting, so that sql does all the job(default value updating) and if I pass different value in update via c# it should update the database(which is not working at the moment)? If you didn't understand the question, please let me know?
Please check the comments if you didn't understand the question?