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
Dov_BAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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
Cloud Class® Course: C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

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

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.