| Author: venkatesan 18 Jul 2008 | Member Level: Diamond | Rating: Points: 4 |
DataRow dr; DataSet ds; // this is bound to DataGridView
// some logic setting up dataset and tables within
dr = ds.Tables[0].NewRow(); // Table[0] of ds is the data I want to display dr["Column1"] = "Finally"; dr["Column2"] = "Got"; dr["Column3"] = "this"; dr["Column4"] = "Working";
// add row to dataset now ds.Tables[0].Rows.Add(dr);
|
| Author: Ven Kates 10 Sep 2008 | Member Level: Bronze | Rating: Points: 4 |
We can also add empty rows in datagridview using this code....
da.Fill(ds, <sourceTable>); for (int i = 0; i < ds.Tables[0].Columns.Count; i++) { string columnName= ds.Tables[0].Columns[i].ColumnName; gridView.Columns.Add(columnName,columnName.ToUpper()); } gridView.Rows.Add(10);
|