数据似乎已保存,但没有显示在数据库中? [英] Data appears to save, but doesn't show up in database?

查看:79
本文介绍了数据似乎已保存,但没有显示在数据库中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不明白这里发生了什么.我发布了我的项目,当我创建新记录并保存它们时,每次运行该程序时,所有内容都会保存并显示出来.我在SQL Server中打开了数据库,但没有一个表包含新数据,但是每次运行该程序时它仍然会显示.

另外,如果我只是通过运行调试模式来执行此操作,新数据将保留在程序中,直到我在SQL Server中检查数据库,然后在其中打开表后,下次调试时该数据将不再存在.

我不知道为什么它会在已发布的程序中生效但不会显示在数据库中.有什么想法吗?

I don't understand what's going on here.  I published my project, and when I create new records and save them, everything gets saved and shows up each time I run the program.  I open the database in SQL Server and none of the tables have the new data, but it still shows up when I run the program each time.

Also, if I do this just by running debug mode, new data stays in the program until I check the database in SQL Server, then once I open the tables in there, the data is no longer present next time I debug. 

I don't know why it takes affect in a published program but won't show in the database.  Any ideas?

推荐答案

您是否将SQL Server Express与本地文件一起使用?如果是这种情况,并且数据库文件是项目的一部分,则可能要运行的是在运行应用程序时将数据库文件复制到Debug或Release文件夹中.因此,数据库更新发生在副本中,而不是项目中的文件.在这种情况下,请将数据库文件移出本地项目,以免被复制.然后,您将只使用数据库文件的单个副本.

HTH

Doug Rothaus
Visual Studio语言UE
douglasr @ microsoft .com
此信息按原样提供,不提供任何担保,也不授予任何权利.
Are you using SQL Server Express with a local file? If this is the case, and the database file is part of your project, what you could be running into is that the database file gets copied to the Debug or Release folder when you run your app. As a result, the updates to the database occur in the copy, but not the file in your project. If this is the case, move your database file outside of your local project so that it doesn't get copied. Then you'll only be working with a single copy of the database file.

HTH

Doug Rothaus
Visual Studio Languages UE
douglasr@microsoft.com
This posting is provided AS IS, with no warranty, and confers no rights.


这篇关于数据似乎已保存,但没有显示在数据库中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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