Solved

c# dump sql queries to excel

Posted on 2006-10-28
3
897 Views
Last Modified: 2008-03-17
I need to grab multiple queries that do not relate to each other at all and want to have them dump into an excel spreadsheet or word.

I want to ensure I go about doing it the best way.

I didn't really want to reference excel because of multiple excel versions my customers may have, but I really don't think I have a choice.

Any thoughts and/or ideas?

0
Comment
Question by:bman9111
3 Comments
 
LVL 35

Expert Comment

by:Raynard7
ID: 17826920
Well,

I'd suggest that if you do not want to use multiple excel libaries then you save your data as .csv - and comma delimit everything this way that anyone with a spreadsheeting program will be able to open the result of your sql queries.  it just means you may have multiple files.

Otherwise it is awkward to include all the different libraries for excel and you may also get into licencing problems if you have to grab these for multiple clients.

Similarly you may be able to dump them into a rtf file,

then you can specifiy your formatting so they look acceptable - ie pad your values and dump them into a table.

this all depends on your eventual purpose.  Another approach that I have seen work quite well is to dump your data into xml and have an xsl style sheet work on your data so anyone with a web browser can see your neatly formatted tables - and can copy them to excel as required.

Alternativley you could just preformat them in c# and use an open source pdf libary and create a pdf for each of your queries.
0
 
LVL 8

Author Comment

by:bman9111
ID: 17827141
can you post code to dump a query to excel and to possible do the dump into xml and have an xsl style sheet that you are suggesting?
0
 
LVL 4

Accepted Solution

by:
Jigit earned 500 total points
ID: 17832930
One can write to Excel file using OLEDB connection independently on Office version:
http://www.developerfusion.co.uk/forums/thread/109392/#109392
0

Featured Post

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
C#.NET and microsoft certification. 3 40
Service Controller 1 23
InputLanguage 1 26
FTP file download using c# 3 22
This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

770 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