4
Answers

Add DataRow into DataTable in C#

Bineesh  VP

Bineesh VP

9y
25.2k
1
Sir, I need your help in how can Add DataRow into DataTable in C#.


Please Take a look to the comboBox Fill Function below. Please correct it.

DataTable dtbl = new DataTable();

 dtbl=SpEmployeeId.ViewEmployeeIdbyEmployeeNameReport(Convert.ToDecimal(cmbEmployee.SelectedValue.ToString()));

  DataRow dRow = dtbl.NewRow();

  dRow["employeeId"] = "All"

  dtbl.Rows.InsertAt(dRow, 0);

  cmbEmployee.DataSource = dtbl;

  cmbEmployee.DisplayMember = "employeeNo";

  cmbEmployee.ValueMember = "employeeId";

My comboBox is to be look like:-

All
2
1
4
8
5
3
Answers (4)