G
Guest
Hello All:
I am using a the following code to insert some values into CE edition
database running on the Desktop.This code works fine as far as inserting the
new record
the problem arises after the app has been shut down. After restarting the
app all the data in DB is gone. Any ideas on what I am doing wrong
conn = new SqlCeConnection("Data Source = MyDatabase#1.sdf");
conn.Open();
cmd = conn.CreateCommand();
cmd.CommandText = "INSERT INTO ExponentialHistory_S(Period,
SalesY1, SalesY2,SalesY3, FileName, Error, A, B) VALUES (?,?,?,?,?,?,?,?)";
cmd.Parameters.Add(new SqlCeParameter("p1", SqlDbType.NVarChar));
cmd.Parameters.Add(new SqlCeParameter("p2", SqlDbType.NVarChar));
cmd.Parameters.Add(new SqlCeParameter("p3", SqlDbType.NVarChar));
cmd.Parameters.Add(new SqlCeParameter("p4", SqlDbType.NVarChar));
cmd.Parameters.Add(new SqlCeParameter("p5", SqlDbType.NVarChar));
cmd.Parameters.Add(new SqlCeParameter("p6", SqlDbType.NVarChar));
cmd.Parameters.Add(new SqlCeParameter("p7", SqlDbType.NVarChar));
cmd.Parameters.Add(new SqlCeParameter("p8", SqlDbType.NVarChar));
cmd.Parameters["p1"].Value = dgMain[0, 0].Value;
cmd.Parameters["p2"].Value = dgMain[1, 0].Value;
cmd.Parameters["p3"].Value = dgMain[2, 0].Value;
cmd.Parameters["p4"].Value = dgMain[3, 0].Value;
cmd.Parameters["p5"].Value = UseFileName;
cmd.Parameters["p6"].Value = dgMain[4, 0].Value;
cmd.Parameters["p7"].Value = dgMain[5, 0].Value;
cmd.Parameters["p8"].Value = dgMain[6, 0].Value;
cmd.ExecuteNonQuery();
I am using a the following code to insert some values into CE edition
database running on the Desktop.This code works fine as far as inserting the
new record
the problem arises after the app has been shut down. After restarting the
app all the data in DB is gone. Any ideas on what I am doing wrong
conn = new SqlCeConnection("Data Source = MyDatabase#1.sdf");
conn.Open();
cmd = conn.CreateCommand();
cmd.CommandText = "INSERT INTO ExponentialHistory_S(Period,
SalesY1, SalesY2,SalesY3, FileName, Error, A, B) VALUES (?,?,?,?,?,?,?,?)";
cmd.Parameters.Add(new SqlCeParameter("p1", SqlDbType.NVarChar));
cmd.Parameters.Add(new SqlCeParameter("p2", SqlDbType.NVarChar));
cmd.Parameters.Add(new SqlCeParameter("p3", SqlDbType.NVarChar));
cmd.Parameters.Add(new SqlCeParameter("p4", SqlDbType.NVarChar));
cmd.Parameters.Add(new SqlCeParameter("p5", SqlDbType.NVarChar));
cmd.Parameters.Add(new SqlCeParameter("p6", SqlDbType.NVarChar));
cmd.Parameters.Add(new SqlCeParameter("p7", SqlDbType.NVarChar));
cmd.Parameters.Add(new SqlCeParameter("p8", SqlDbType.NVarChar));
cmd.Parameters["p1"].Value = dgMain[0, 0].Value;
cmd.Parameters["p2"].Value = dgMain[1, 0].Value;
cmd.Parameters["p3"].Value = dgMain[2, 0].Value;
cmd.Parameters["p4"].Value = dgMain[3, 0].Value;
cmd.Parameters["p5"].Value = UseFileName;
cmd.Parameters["p6"].Value = dgMain[4, 0].Value;
cmd.Parameters["p7"].Value = dgMain[5, 0].Value;
cmd.Parameters["p8"].Value = dgMain[6, 0].Value;
cmd.ExecuteNonQuery();