Bineesh  Viswanath

Bineesh Viswanath

  • NA
  • 1k
  • 760.6k

Add DataRow into DataTable in C#

Oct 31 2013 6:28 AM
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)