MS Access数据自动删除 [英] MS Access data deleted automatically

查看:68
本文介绍了MS Access数据自动删除的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,
我正在使用Windows Access在后端使用MS Access数据库文件.
我用来从用户那里获取数据并将其存储在访问数据库表中.我的代码如下,

Hello all,
I am working on windows aplication with MS Access database file at backend.
I use to get the data from user and stored it in access database table.My code is as follows,

OleDbConnection con = new OleDbConnection(@"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=F:\TUTORIALS\APPLICATIONS\DOT NET APPLICATIONS\VEDIKA ENTERP. SOFTWARE\VEDIKAENTO_ORDER_FORM\VEDIKAENTO_ORDER_FORM\bin\Debug\VEDIKAENT.accdb");
            con.Open();
            //Command to insert records into distributer Table.
            OleDbCommand cmd = new OleDbCommand("INSERT into Distributor(Dist_code,Dist_name,Type,RtgsUtrNo,Bank)VALUES ('" +txtdistcode.Text  + "', '" +txtdistname.Text + "','"+txtdisttype.Text+"','"+txtrtgs.Text+"','"+txtdistbank.Text+"')",con);
            int k = 0;
            k=cmd.ExecuteNonQuery();
            if (k == 1)
            {
                MessageBox.Show("Record Added Successfully");
             }
              con.close()


数据条目存储在表中指定临时文件.当我关闭应用程序时
并重新运行,我将找不到任何记录.

因此,有人对此有解决方案,这样我就可以永久地对数据库进行更改??
有人可以帮我吗?


The data entry get stored in table specify temparary.When I close the aplication
and re-run there will be no single record i found.

So anybody have solution on that so i can make changes in the database permanatly???
can anybody help me???

推荐答案

最可能的原因是,在编译accdb文件时,它会复制到调试目录中.因此,您所做的每项更改都将丢失.如果包含了访问数据库,则不要在您的项目中包括它,或者至少不要让编译器将其复制到输出目录中.
The most likeliest reason is that when you compile the accdb file is copied to your debug directory. So every change you have made is lost. Don''t include the access database in your project if it is included or at least don''t let the compile to copy it to the output directory.


这篇关于MS Access数据自动删除的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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