How to Dynamically Build a Table in ASP.NET Using C#/ASP.NET From Database Search Results

Posted on 2011-10-11
Last Modified: 2013-12-16
I have successfully queried a database, and I am at the point of displaying the results of a query that is run on a web page called Results.ASPX. I am new to ASP.NET, and I was attempting to figure out the syntax to dynamically build the ASPX page from within the C#/ASP.NET code. (I have attached a snippet of code that is being used in order to build the query and is called upon the RESULTS.ASPX page being loaded.) Could someone help me with the syntax that I would need in order to have the results displayed in a table with each column, or attribute, from the query being a new column in the table and each record being a new row.

Any help is greatly appreciated.
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

namespace Research
    public partial class Results : System.Web.UI.Page
        String AutoSales;
        String CarModel;
        String CarColor;

        protected void Page_Load(object sender, EventArgs e)
		AutoSales = Request.QueryString["Sales"];
		CarModel = Request.QueryString["Model"];
		CarColor = Request.QueryString["Color"];
		OracleConnection conn = new OracleConnection();
		conn.ConnectionString = WebConfigurationManager.AppSettings["CarConnection"];
		DataSet ds = new DataSet("car_receipt");
		String strSelect = "Select * From CarInfo Where Sales = '" + AutoSales + "' AND Model = '" + CarModel +"' AND Color = '" + CarColor + "';
		        OracleDataAdapter DA = new OracleDataAdapter(strSelect, conn);

Open in new window

Question by:thenthorn1010
    LVL 11

    Accepted Solution

    you add a gridview on the page and bind it to the dataset:
    LVL 11

    Expert Comment


    Featured Post

    Maximize Your Threat Intelligence Reporting

    Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

    Join & Write a Comment

    User art_snob ( encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
    It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
    Internet Business Fax to Email Made Easy - With eFax Corporate (, you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
    Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

    755 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

    20 Experts available now in Live!

    Get 1:1 Help Now