将数据保存到数据库 [英] save data to DB

查看:210
本文介绍了将数据保存到数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用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 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

解决方案

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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆