Populate a DataSet :by creating DataTable, DataColumn and DataRow objects programmatically.

DataSet dset;
DataTable dtbl;
DataRow drow;
//create a new row

drow=dtbl.NewRow();
//manipulate the newly added row using an index or the column name

drow["LastName"]="yash";
drow[1]="yash";
//After data is inserted into the new row, the Add method is used

//to add the row to the DataRowCollection

dtbl.Rows.Add(drow);
//You can also call the Add method to add a new row by passing in an

//array of values, typed as Object

dtbl.Rows.Add(new object[] {1, "yash"});

0 comments: