0
votes

I have small issue, I have datagridview in form1 to which I insert data from form2 using SQL commands, but after button click which includes INSERT command the newly inserted value doesn't appear in form1's datagridview. Is there any way to solve this ?

4
Please give us some code...Usman Khalid
Show us the code. I recommend using DataSourcepayo
In form2 public Applications Applications; private void btnSave_Click(object sender, EventArgs e) { String sSql = "INSERT INTO Application---- setup.SetQuery(sSql); } this.Close(); Applications.Refresh();user3414030

4 Answers

0
votes

You Can Use

GridView1.DataBind();
0
votes

ftry this

Form1 frm = new Form1();
frm.methodwhereyoubindgrid();

but the method must be public in the form1

0
votes

Just Rebind the data to the girdview after every insert.

gridview.DataSource=new Datasource;
gridview.DataBind();
0
votes

Simply call the GridView Bind Again at Button Click

inside button1_click

Grid1_Databind(); 

Rebind the data to the gridview after every insert.

gridview1.DataSource = new Datasource;
gridview1.DataBind();