• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 261
  • Last Modified:

Changes I am making to my database during runtime are not permanent

I am using vb.net 2008 express sqlce
when I first started using sql to add and delete records to my database file during runtime the changes remained permenat and I could see them in the database explorer
Now when I delete records when I rerun the program they reappear and when I add records they dont last after I shutdown the application
I did make certain change so that the database would install with my application on other machines
what do I do so that changes will be permanent
0
Dov_B
Asked:
Dov_B
  • 6
  • 4
3 Solutions
 
PlatoConsultantCommented:
right click on database file e.g .mdf or .mde, and select copy if newer from the copy option in the properties.
 
0
 
PlatoConsultantCommented:
Actually happen in visual studio the copy u r using is copied in the bin directory at the run time and every time u build it is over written by the copy in your database folder.  hence u select the option copy if newer from it.
 
0
 
Dov_BAuthor Commented:
I put it on copy if newer and the changes during runtime are still not permanent
0
Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

 
PlatoConsultantCommented:
Can u please upload any sample project so i can look in to it..
0
 
Dov_BAuthor Commented:

Sub myCommnd(ByVal mSql As String)
Dim constring = "Data Source=" & Application.StartupPath & "\Database1.sdf;Persist Security Info=False;"
Dim myCon As New SqlCeConnection(constring)
Dim f As New SqlCeCommand(mSql, myCon)
myCon.Open()
' Create and fill dataset
f.ExecuteNonQuery()
myCon.Close()
0
 
Dov_BAuthor Commented:
this is a view of mydatbases's properties
database.bmp
0
 
Dov_BAuthor Commented:
oops I left out the sql for the command
dim mSql="insert into table values('a')"
Dim f As New SqlCeCommand(mSql, myCon)
 myCon.Open()

f.ExecuteNonQuery()
myCon.Close()
0
 
PlatoConsultantCommented:
ur problem solved now?
0
 
Dov_BAuthor Commented:
no
0
 
Dov_BAuthor Commented:
I moved the database file to a different folder other then the bin and the changes I made to my database remained permanent
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 6
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now