I want to add Rows in DataGridView Dynamicaly,,, I have written following code...
SqlDataAdapter da = new SqlDataAdapter("select * from auth",cs);
SqlCommandBuilder cmb = new SqlCommandBuilder(da);
DataTable dt = new DataTable();
da.Fill(dt);
int found = dt.Rows.Count;
DataRow dr;
for (int i = 0; i <found; i++)
{
dr = dt.Rows[i];
dataGridView1.Rows.Add(dr);
}
_____________________________________
But this says that
"No row can be added to a DataGridView control that does not have columns. Columns must be added first."
Howto correct this?
NIIT HOUSE GKP INDIA
Please mark the replies as answers if they help and unmark if they don't.