SoniX
2008-06-15 09:55:03 UTC
I have created a table and then I try to add a value to the table. It works, my coding works, becuase in the program I call the table again and it shows the new value, BUT, the moment when I close my program I lose those changes.
Why is this?
Here is some of my code.
SqlConnection myConnection = new SqlConnection();
myConnection.ConnectionString = Properties.Settings.Default.Setting;
myConnection.Open();
SqlCommand myCommand = new SqlCommand();
myCommand.Connection = myConnection;
myCommand.CommandText = ("UPDATE Stock SET Stock_Quan = " + newFigure +
" WHERE StockName = '" + stockBox.Text + "';");
myCommand.ExecuteNonQuery();
myConnection.Close();
ANY help will be so greatly appreciated. THANK YOU.