Skip to content

Displaying a whole table from the database

Farhana Khan

Asked Mar 5, 2013, 6:05 PM EST1 answer
Share
LinkedInX
I am having a table in my database named Feedbacks and i need to diplay in the page of admin when admin will be going to click on the view feedback button then the whole feedback table with the buttons reply,add delete for each row should be displayed. The columns in my feedback table were commenton,commentabout,your comment,,etc

1 Answer

Know the answer? Post it. Somebody with the same question will find it here.

  • Vishal Gilbile
    0
    Hello,
             Your question is not quite clear but certainly what I understood is that you want to display data from a particular table with all the rows and column. In such case what you can do is you can create a procedure which will display data from database particular table or you can use the following line of code.

    con = new SqlConnection("Data Source=D-NIIT-CR02;Initial Catalog=AdventureWorks;User Id=

    Code
    XX;Password=XXX");
    da = new SqlDataAdapter("Select * from Feedback", con);
    ds = new DataSet();
    da.Fill(ds, "dsFeedback");
    GridView1.DataSource = ds.Tables["Feedback"].DefaultView ;
    GridView1.DataBind()
    
    
    If this doesn't solves your problem kindly let me known.
    0