In the project, I have a local database (I use datagrid to view the data), but the problem is that when pasting into the database using the insert request, the insert is not long, i.e. when I restart the application, the database does not change and the changes are not reflected in the database view (lookup table data in Visual Studio).
Request for input:
string dbCon = new System.IO.FileInfo(System.Reflection.Assembly.GetExecutingAssembly().Location).DirectoryName + "\\MyDatabase.sdf";
SqlCeConnection dbconnection = new SqlCeConnection("datasource=" + dbCon);
dbconnection.Open();
String Insert = "insert into MainTable(LineID,Date,Connection_Type) Values('5','5/8/2012','commercial')";
SqlCeCommand cmd = new SqlCeCommand(Insert, dbconnection);
cmd.ExecuteNonQuery();
dbconnection.Close();
Now that this code is working, the datagrid is updated, but the changes are not permanent. What am I doing wrong? I am using Visual Studio 2010 Ultimate and Windows 7
source
share