实体数据未保存到SQL数据库 [英] Entity Data not being saved to the SQL database

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

问题描述

Hi *,



EF新手。



我有一个场景,我修改并插入数据到一个表(使用SaveChanges()方法)。 当我重新显示网格时它们出现。 如果我关闭应用程序(但不关闭) VS2008)并重新运行应用程序中存在的更改。



但是,如果我关闭应用程序,关闭VS2008并重新打开,则数据尚未更改。 当然,查看SQL表中的更改不存在。




因此,即使应用程序关闭并重新打开,实体也会看到更改,但仍保留更改,但绝不会将其写入表中。 / p>

>这几乎就像我需要做一个Commit.Transaction类型的过程来进行。





我正在使用SQLEXPRESS(这可能是另一个问题)并指向通过USB端口连接的拇指驱动器上的.mdf和.ldf文件。 (开发)



有谁知道为什么我无法保存我的更改?



谢谢!



Eric

解决方案

嗨*,

另外,我正在工作在WinForms应用程序上。 Everyting似乎在我正在玩的Web应用程序上正确保存。我关闭并离开并梳理。然而,Web应用程序正在与"真实"对话。企业服务器上的SQL 2005数据库。

问题可能与SQL Express有关吗?

混淆了什么?

再次感谢所有人。

埃里克


Hi *,

 

New to EF.

 

I have a scenario where I modify and insert data into a table (using the SaveChanges() method).  They appear when I redisplay the grid.  If I close the application (but not close VS2008) and re-run the application the changes are present. 

 

However, if I close the application, close VS2008, and reopen all, the data has not been changed.  And of course looking at the SQL table the changes are not there.

 

So the entity sees the change, holds onto the change even when the application is closed and re-opened, but never writes it to the table.


It is almost like I need to do a Commit.Transaction type process to make them take.

 

 

I am using SQLEXPRESS (which may be another issue) and pointing to a .mdf and .ldf file on a thumbdrive connected through a USB port. (Development)

 

Does anyone know why I can’t save my changes? 

 

Thanks!

 

Eric  

解决方案

Hi *,

In addition,  I am working on a WinForms application. Everyting seems to be saving correctly on a Web application that I am also playing with.  I close and leave and comback in.  However, the web application is talking to a "true" SQL 2005 database on a corporate server. 

So could the problem be with SQL Express?

Confused???

Thanks again to all.

Eric


这篇关于实体数据未保存到SQL数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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