How to persist inserted records in an .MDF file? Inserted records dissappear.
Posted on 2007-08-11
How do you persist data in an .MDF file? I created an app that has a data source to an sql .MDF file, but I am not using the server (kind of like using an access database file). I execute this code with no error, but when I close the app and open it again, the data is not in the table. Why would this be?
My test code is like this
SqlConnection myConn = new SqlConnection(s.ConnectionString);
for (int i = 0; i < 1000; i++)
string SQL = "INSERT INTO TEST_TABLE (FIELD1, FIELD2, FIELD3)" +
" VALUES ('TestData1'," +
SqlCommand ins = new SqlCommand(SQL, myConn);