How to have a query output to Excel without listing every field?

Hi,

I have two parts to this question:
1.  How can I export my query to Excel when the user clicks on the link to the page with the query in it.
2.  Is it possible to not have to list all the fields in the query for the output on the query page?

I Have some simple reports to do.  The table has probably about 40 fields.
I do not want to list the query and then list all the fields in the query for output.
I want to do the list of the query results dynamically.
LVL 1
g118481Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

dgrafxCommented:
Try this on the page you want to export to excel
<cfcontent type="application/excel">
<cfheader name="Content-Disposition" value="filename=Results.xls">

Do you mean for part 2 that you want to display x number of fields on your query page, but not export all of them to excel?
If thats what you mean then on your query page you'll have a link that says "click here to output to excel" or whatever
add a target value to the link which would be a hidden iFrame where you do a different query that contains only the fields you want output to excel.
The above cfcontent & cfheader would need to be on this hidden iFrame page
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
g118481Author Commented:
I cannot use the cfcontent tag on my host site.
Is there another way to export my cfquery to excel?
0
dgrafxCommented:
not that I know of using ColdFusion.
Although there may be a custom tag available somewhere.
But if your host won't allow cfcontent, then they probably don't allow custom tags.

Get a new host!
There are several very affordable ColdFusion hosts who do not put restrictions on you.
Your current host not allowing certain tags really means that they don't know how to configure each customers sandbox correctly so they just apply a blanket restriction.
Bogus!

Good luck ...
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Web Servers

From novice to tech pro — start learning today.