I have one table in SQL Server that contains datetime columns. I use LINQ to SQL.
While running the program all data is saved in a table and I get all the results properly.
But as soon as I close the run, there is no data in the table and the getall function returns null.
I can not find the problem.
The code to insert data into a table is:
public bool AddTime(WorkTime ToAdd)
{
try
{
_context.WorkTimes.InsertOnSubmit(ToAdd);
_context.SubmitChanges();
}
catch (Exception)
{
return false;
}
return true;
}
Most likely, you using a SQL Server Express Edition standalone file, that is getting re-deployed (copied to the output folder) every time you build.
Options:
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With