I have an widnows form aplication and i can't save the data from aplication(textboxes) in the database (ms access). The stored data is seen in the aplication, but if i open the database it's not there... so if i open the database and restart the form aplication i don't see the before inserted data .
string conString = "Provider=Microsoft.Jet.OLEDB.4.0;"
+ " Data Source=save.mdb";
OleDbConnection empConnection = new OleDbConnection(conString);
string insertStatement = "INSERT INTO zivila "
+ "([naziv]) "
+ "VALUES (@naziv)";
OleDbCommand insertCommand = new OleDbCommand(insertStatement, empConnection);
insertCommand.Parameters.Add("@naziv", OleDbType.Char).Value = textBox1.Text;
try
{
empConnection.Open();
int count = insertCommand.ExecuteNonQuery();
empConnection.Close();
}
catch (OleDbException ex)
{
MessageBox.Show(ex.Message);
}
finally
{
textBox1.Clear();