问题
I am using Visual Studio 2010 with SQL Server Express and LINQ to SQL
The application runs correctly when inserting data into the database during application execution. The data is inserted to the database. But, when I stop the application and click show table data
in server explorer
I do not see any data. Why is this so?
Here the values for the copy output direction properties for my database solution items:
database1.mdf: copy always
database1Dataset.xsd: do not copy
dataclasses1.dbml: do not copy
回答1:
database1.mdf=====> properties =======>copy output direction=copy always
This is why. You are editing a copy of the database each time you start a new debug session. Set it to do not copy
and your updates will persist.
来源:https://stackoverflow.com/questions/6065914/save-data-to-db