sdf在关闭应用程序后不会更新

sdf在关闭应用程序后不会更新

本文介绍了c# - 数据库文件.sdf在关闭应用程序后不会更新...的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个带有.sdf数据库的C#应用​​程序,我有SELECT,UPDATE和INSERT,以及我在编译应用程序时所有工作。



我的意思是,我添加,删除和修改记录,它可以正常运行,我可以在应用程序运行时播放我的所有信息。但是,如果我关闭应用程序并在它之后,我再次运行它,所有数据都像在开始,我的DB.sdf没有任何变化



它看起来好像我的所有更改都在RAM内存或类似内容...



这是我的更新代码:





I am developing a C# application with a .sdf database, I have SELECTs, UPDATEs and INSERTs, and all they work while I'm compiling the application.

I mean, I add, delete and modify records, and it works okay i can play with all my information while the app is running. BUT if I close the app and after it, I run it again, all the data is like in the begining, there's not any change in my DB.sdf

It looks like if all my changes were on the RAM memory or something like that...

This is my UPDATE code:


SqlCeConnection connDisp = new SqlCeConnection();
                    connDisp.ConnectionString = ("Data Source =" + (System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase)) + "\\ACB.sdf;Password=acaf;Persist Security Info=False;");
                    try
                    {
                        connDisp.Open();
                        StringBuilder query = new StringBuilder();
                        SqlCeCommand comm = new SqlCeCommand();

                        query.Append("UPDATE ACCT SET NPL ='0004',MODO='M' WHERE NUVO='00003' AND NUIA= '01' AND NUPO= '00700' AND SMCT='000' ");
                        comm.CommandText = Convert.ToString(query);

                        comm.Connection = connDisp;
                        comm.ExecuteNonQuery();
                        comm.Dispose();
                        this.Refresh();
                        connDisp.Close();
                    }
                    catch (SqlCeException exce)
                    {
                        MessageBox.Show("Exception: "+exce.Message);
                    }







**任何关于为什么我不能写我的书的想法。 sdf数据库?**

我访问了很多博客,但是有人帮助了我。

如果我要求一个演示移动应用程序是不是错了?



希望有人帮助我

谢谢..




**Any idea about Why I can't write on my .sdf database?**
I've visited lots of blogs but anyone helped me.
Is it wrong if I ask for a demo mobile app?

Hope somebody help me
Thank You..

推荐答案


这篇关于c# - 数据库文件.sdf在关闭应用程序后不会更新...的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-05 16:59