Windows Develop Bookmark and Share   
 index > Windows Forms Data Controls and Databinding > Need to Export several SQL Server Queries results to Excel
 

Need to Export several SQL Server Queries results to Excel

I have a Form that I created in Visual Studio 2008that I want to use to execute a query on SQL Server then return the results back to Excel in a specific worksheet. Can this be done easily? I don't have much experience with VB .Net, I have done this in Access using the TransferSpreadSheet method but I am in the process of transfering everything to SQL Server and need to replicate.
bconner  Friday, August 07, 2009 11:46 AM
If you get the data from SQL Server as a DataTable, you can write the DataTable to an Excel spreadsheet with the code shown here:

http://msmvps.com/blogs/deborahk/archive/2009/07/23/writing-data-from-a-datatable-to-excel.aspx

Hope this helps.
www.insteptech.com ; msmvps.com/blogs/deborahk
We are volunteers and ask only that if we are able to help you, that you mark our reply as your answer. THANKS!
DeborahK  Wednesday, August 12, 2009 12:15 AM
If you get the data from SQL Server as a DataTable, you can write the DataTable to an Excel spreadsheet with the code shown here:

http://msmvps.com/blogs/deborahk/archive/2009/07/23/writing-data-from-a-datatable-to-excel.aspx

Hope this helps.
www.insteptech.com ; msmvps.com/blogs/deborahk
We are volunteers and ask only that if we are able to help you, that you mark our reply as your answer. THANKS!
DeborahK  Wednesday, August 12, 2009 12:15 AM

You can use google to search for other answers

Custom Search

More Threads

• Object reference not set to an instance of an object - .NET 2.0, GridView column
• Automatic scrolling in Datagrid view
• Basic Problem, i guess
• How to show default selected value of combobox in datagridview
• databinding is not working
• The Connection has been disabled
• How can I set a value in a cell of the DataGridView that contains a DataGridViewComboBoxColumn?
• Hierarchical data grid control
• Testing FindBy Method for returned Null
• Convert numeric, logical to which type?