views:

66

answers:

0

How can i refresh the data from my database(ms access) in c# using windows form aplication? part of the code where i insert the data :

insertCommand.Parameters.Add("@ID_uporabnika", OleDbType.Integer).Value = Convert.ToInt32(textBox6.Text);
insertCommand.Parameters.Add("@datum", OleDbType.DBDate).Value = DateTime.Now.ToShortDateString();
insertCommand.Parameters.Add("@ID_zivila", OleDbType.Integer).Value = Convert.ToInt32(iDTextBox.Text);
insertCommand.Parameters.Add("@skupaj_kalorij", OleDbType.Double).Value = Convert.ToDouble(textBox1.Text);
empConnection.Open();

try
    {
        int count = insertCommand.ExecuteNonQuery();
    }
catch (OleDbException ex)
    {
        MessageBox.Show(ex.Message);
    }
finally
    {
         empConnection.Close();
         MessageBox.Show("zauižiti obrok je bil shranjen");
         textBox1.Clear();
         textBox2.Clear();
         textBox3.Clear();
         textBox4.Clear();
         textBox5.Clear();
    }
}