• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 172
  • Last Modified:

How to include a new row in a Dataset

I am populating a combo box using a dataset. I manually add one row to the dataset by using this code.
cboMP.DataSource = rsMP.Tables[0];
cboMP.DisplayMember = "marketing_program";
cboMP.ValueMember = "program_id";
rsMP.Tables[0].Rows.Add("");

I want the row that I am adding to be the first item in the combo box instead it ends up being the last item. Is there a way for me to move this item all the way to the top. I dont have permission to add a new row in the table.

0
pratikshahse
Asked:
pratikshahse
  • 2
1 Solution
 
p_davisCommented:
try the insertat method
dataset.tables[0].rows.insertat(row,0)
0
 
JimBrandleyCommented:
This will do it.

DataRow row = rsMP.Tables[0].NewRow();
rsMP.Tables[0].Rows.InsertAt(row, 0);

Jim
0
 
p_davisCommented:
uhh, that's basically what i said....
--no matter
0

Featured Post

Prep for the ITIL® Foundation Certification Exam

December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now