1
Answer

datagridview

Photo of kal k

kal k

18y
2.7k
1

Hi,
Iam using datagridview,How to add a new row to the datagrid view?
In insert button i wrote  this code,
dataGridView1.Rows.Add(3);
when i run this code,it is giving the following exception
exception: rows cannot be programatically to the datagridview's collection when control is databound

In save button i wrote like this,

private void button1_Click(object sender, EventArgs e)

{da.Update(ds,"emp");

}

It is giving the following exception:

 Update requires a valid InsertCommand when passed DataRow collection with new rows.


Please help me.
Thanks In Advance


Answers (1)