Skip to content

How to import the data from an sql table to an Excel without using gridview?

zaheer ahmed

Asked Mar 15, 2011, 12:00 AM EDT2 answers
Share
LinkedInX
I am new to .net, so i will be really thankful to u if u could help me on how to display a SQL table on an EXCEL form through the dataset without using the Gridview.
Please tell me in detail on how i need to  proceed...
I have a code where i use a gridview. please find it.

2 Answers

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

  • Mahesh Chand
    0
    Well, if you do not want to use the GridView control, there are two aspects to it and it will not be easy.

    Here are the required steps.

    1. You need to get all data in a DataSet or DataTable, which you may already have in your application.
    2. You need to create an Excel sheet (search this website on how to create an excel sheet). Then add columns to it or use default columns.
    3. Get data from DataTable or DataSet, one row at a time and add rows to your Excel sheet

    You will use Office Interop to build the Excel sheet and add data to it.

    Also, look at Office Interop section of this website.

    Good luck!
    0
  • Suthish Nair
    0
     Or another way do a for loop of each rows and create runtime html tags and create file using Response.Write method.
    0