将数据保存到数据库 [英] save data to DB
问题描述
我使用Visual Studio 2010与SQL Server Express和LINQ to SQL
应用程序应用程序执行期间将数据插入数据库时运行正常。的数据被插入到数据库中。但是,当我停止应用程序,并单击显示表数据
在服务器资源管理器
我没有看到任何数据。为什么会这样
下面为我的数据库解决方案项目拷贝输出方向属性的值:
database1.mdf:副本总是
database1Dataset.xsd:不要复制
dataclasses1.dbml:不要复制
database1.mdf =====>属性======= >拷贝输出方向=拷贝总是
块引用>
这是为什么。您每次启动一个新的调试会话时编辑数据库的副本。将其设置为
不要复制
键,您的更新将持续存在。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
inserver 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
解决方案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.这篇关于将数据保存到数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!