Click here to Skip to main content
15,881,424 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Data are saved temporary to an ms access database using vb.net, when I terminate the application the data are automatically deleted from database

how can i solve this problem..?

code given below
VB
Dim ConnnectionString As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=<database_name>.mdb"
Dim cn As New OleDbConnection(ConnnectionString)
cn.Open()


Dim db As String = "INSERT INTO <table> VALUES('" & TextBox1.Text & "','" & TextBox2.Text & "','" & TextBox3.Text & "','" & TextBox2.Text & "')"
Dim da As New OleDbCommand(db, cn)
Dim rd As OleDbDataReader
rd = da.ExecuteReader();
da.ExecuteNonQuery()
cn.Close()
Posted
Updated 11-Aug-13 22:43pm
v2
Comments
[no name] 1-Aug-13 1:44am    
what you want to solve..??saving the data or deletion of data.
Sanjith S 1-Aug-13 1:49am    
i want save the data in permently....
[no name] 1-Aug-13 1:50am    
how you are saving data..??button click..???
Sanjith S 1-Aug-13 1:59am    
ya button click.
[no name] 1-Aug-13 3:58am    
in that case please post your code..because without that we can't say anything...

In most cases this behaviour occurs because the database is placed in a root directory of project or inside one of subfolder.
Move the database from ...Project\ or ...Project\Bin\ or ...Project\Bin\Debug folder to any other folder, for example: D:\MyDatabase\ ;)

Call again, if it won't help.
 
Share this answer
 
Once you write the data to the database, it's there, permanently, until some code comes along and deletes it. So, whatever is "deleteing" this data, if in fact it's actually being deleted, it's happening in your code somewhere, or some other app connecting to the same database, and not because your application was terminated.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900