ASP.NET - Build a DataTable from scratch

Posted on 2009-04-22
Last Modified: 2012-05-06
I have some data that I would like to display in a gridview so I can take advantage of the formatting features that it offers.  However, the data that I currently have from the database is not organized in a way that I would like to display it in the gridview.  I want to reorganize it and prepare a new DataTable to bind to the gridview control.

What is the process that I would go through to create a new DataTable, define its column names, create the individual DataRows and start adding them to the DataTable?
Question by:josephdaviskcrm
    LVL 15

    Expert Comment

    what you mean by not it the sequence or what.
    I would rather write the query in such a way i need and let the grid do the rest
    LVL 15

    Accepted Solution

    Anyway if that is what you want here is how

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    6 Surprising Benefits of Threat Intelligence

    All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

    Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
    This article discusses the ASP.NET AJAX ModalPopupExtender control. In this article we will show how to use the ModalPopupExtender control, how to display/show/call the ASP.NET AJAX ModalPopupExtender control from javascript, how to show/display/cal…
    Hi everyone! This is Experts Exchange customer support.  This quick video will show you how to change your primary email address.  If you have any questions, then please Write a Comment below!
    This video is in connection to the article "The case of a missing mobile phone (". It will help one to understand clearly the steps to track a lost android phone.

    737 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

    19 Experts available now in Live!

    Get 1:1 Help Now