How to include a new row in a Dataset

Posted on 2007-09-28
Last Modified: 2013-12-17
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";

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.

Question by:pratikshahse
    LVL 22

    Expert Comment

    try the insertat method
    LVL 22

    Accepted Solution

    This will do it.

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

    LVL 22

    Expert Comment

    uhh, that's basically what i said....
    --no matter

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Better Security Awareness With Threat Intelligence

    See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

    This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
    Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
    Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
    In this sixth video of the Xpdf series, we discuss and demonstrate the PDFtoPNG utility, which converts a multi-page PDF file to separate color, grayscale, or monochrome PNG files, creating one PNG file for each page in the PDF. It does this via a c…

    758 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now