yokzu

yokzu

  • NA
  • 306
  • 0

Updating datagridview?

Sep 27 2009 10:26 AM
Hi.
I am showing my db on datagridview. When I click a button, there are insert and update sql querys working. Of course db is changing but datagridview is not updating. How can I update simultaneously when I click the button?

 private void btn_Click(object sender, EventArgs e)
        {
            OleDbConnection bag = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=db.mdb;");
            string sms_metni = webBrowser1.Document.GetElementById("textbox").GetAttribute("value");
            string query_sms = "INSERT INTO sms (sms_metni,toplam_kisi) VALUES ('+sms_metni+','" + dataGridView3.RowCount.ToString() + "')";
            OleDbCommand cmd = new OleDbCommand(query_sms,bag_sms);
            bag_sms.Open();

            cmd.ExecuteNonQuery();
            bag_sms.Close();
            ----> How can I update datagridview in here?

        }

Answers (8)