Hi all,
I just need an idea (not code) how to export data from my databse to excel sheet..that too row wise..
I only need a starting idea... m using Visual studio 2008.
One way to export data to an (existing) Excel file is to use OleDb (namespace System.Data.OleDb). Check out Connection strings for Excel how to form a proper connection string to access an Excel file.
If you want to write a general Excel export, I suggest importing data from the data source to a DataView object and passing that to a routine which export DataView to XLS-file. A DataView object contains both data and field names.
And one thing to remember with Excel files is that the table names are Excel sheet names, for example "[sheet1$]". That caused me a bit headache before I realized it
Dim tw AsNew System.IO.StreamWriter("E:\SBS_sample.csv")
tw.Write(dataExport)
tw.Close()
this is what i have done,but this is in csv format. i am reading my data from the GridView just for checking of it works, but cudnt get it working.. if any changes??
Hi all,
I just need an idea (not code) how to export data from my databse to excel sheet..that too row wise..
I only need a starting idea... m using Visual studio 2008.
Hi,
Here is my Idea,
Open the excel using the connection,
Query the EXCEL for the data u need,
store it in a dataset,
loop through the dataset for the rows of its table,
get the item details
and use it as the parameter for the database query or stored procedure
I was able to export the data from database to excel using gridview but now the problem is how to append new values in the same existing excel sheet that i created earlier while exporting the data from gridview. I keep losing formats in the xcel sheet.
Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.
This thread is more than three months old
No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.