Access Data Table : Update / Insert
-
hi , i am using this code to insert a record into data table objCommand = new OleDbCommand(str, objConnection1); objCommand.Parameters.Add("@sid", OleDbType.Integer); objCommand.Parameters.Add("@nm", OleDbType.VarChar, 255); objCommand.Parameters["@sid"].Value = textBox1.Text; objCommand.Parameters["@nm"].Value = textBox2.Text.Trim(); objConnection1.Open(); data = objCommand.ExecuteNonQuery(); it works and it display that record in the grid when i reload data grid. BUT the the record does not store permanently in the table. IT dose not display that record when i restart the application. what is the problem...:rose:
-
hi , i am using this code to insert a record into data table objCommand = new OleDbCommand(str, objConnection1); objCommand.Parameters.Add("@sid", OleDbType.Integer); objCommand.Parameters.Add("@nm", OleDbType.VarChar, 255); objCommand.Parameters["@sid"].Value = textBox1.Text; objCommand.Parameters["@nm"].Value = textBox2.Text.Trim(); objConnection1.Open(); data = objCommand.ExecuteNonQuery(); it works and it display that record in the grid when i reload data grid. BUT the the record does not store permanently in the table. IT dose not display that record when i restart the application. what is the problem...:rose:
What kind of database do you use? MS Access? Did you checked for the AutoCommit-flag? I'm just guessing, but maybe the internal transaction is not committed. Regards Sebastian
It's not a bug, it's a feature! Check out my CodeProject article Permission-by-aspect. Me in Softwareland.
-
hi , i am using this code to insert a record into data table objCommand = new OleDbCommand(str, objConnection1); objCommand.Parameters.Add("@sid", OleDbType.Integer); objCommand.Parameters.Add("@nm", OleDbType.VarChar, 255); objCommand.Parameters["@sid"].Value = textBox1.Text; objCommand.Parameters["@nm"].Value = textBox2.Text.Trim(); objConnection1.Open(); data = objCommand.ExecuteNonQuery(); it works and it display that record in the grid when i reload data grid. BUT the the record does not store permanently in the table. IT dose not display that record when i restart the application. what is the problem...:rose:
Hi after posting this threat i got the solution in the solution Explorer first i selected the mdb file; then changed the properties of mdb file.that is copy to output directory : copy if newer that's it !! :-\