ColdFusion Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreColdFusion Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old March 17th, 2005, 04:32 AM
izah_2 izah_2 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2004
Posts: 34 izah_2 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 2 m 48 sec
Reputation Power: 4
export excel

hai..i got problem here..i got error cannot open file when i want to export query to excel...here is my code..

below is the link to another action page...


<Cfoutput><a href="excel.cfm" target ="_blank">Export To Excel</a></cfoutput>



below is the action page (excel.cfm)...


<cfheader value="attachment; filename=excel.xls" name="Content-disposition">
<cfcontent type="application/vnd.ms-excel">

<cfif varLogin EQ 'All'>
<CFQUERY NAME="qSearch" DATASOURCE="#REQUEST.DSN#" >
SELECT EDMS_LOGINHISTORY.*, EDMS_USER.USER_LOGIN, EDMS_USER.USER_NAME
FROM EDMS_LOGINHISTORY, EDMS_USER


</cfquery>

<CFOUTPUT query="qSearch" StartRow="#StartRow#" MAXROWS="#MaxRows#">
<TR bgcolor="white">
<TD align="center"><font size="1">#CurrentRow#</FONT></TD>
<TD align="left"><font size="1">#USER_LOGIN#</FONT></TD>
<TD align="left"><font size="1">#USER_Name#</font></td>
<TD align="left"><font size="1">#Dateformat(TIMELOGIN, 'DD-Mmm-yyyy')# #Timeformat(TIMELOGIN, 'HH:MM:TT')#</FONT></TD>
<TD align="left"><font size="1"><cfif TIMELOGOUT NEQ "">#Dateformat(TIMELOGOUT, 'DD-Mmm-yyyy')# #Timeformat(TIMELOGOUT, 'HH:MM:TT')#</cfif></FONT></TD>
</TR>

</CFOUTPUT>



what is wrong with this code???can somebody help me??

Reply With Quote
  #2  
Old March 17th, 2005, 06:42 AM
fortunato fortunato is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2005
Posts: 33 fortunato User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 17 h 36 m 52 sec
Reputation Power: 4
Your cfcontent and cfheader tags look right, thats usually the key. Other than that, drop those tags and make absolutely sure the page renders a nice clean html table, then put the tags back in place, and hopefully it will work. I see that you have an unclosed <cfif varLogin EQ 'All'> , and you have omitted the opening and closing <TABLE> tags (you will need these). I dont think you absolutely need open/close HTML, HEAD, and BODY tags, but I use them also. The version of Excel you are running may also make a difference. Im running Excel 2002 on Win2k.

Reply With Quote
  #3  
Old March 17th, 2005, 07:19 PM
izah_2 izah_2 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2004
Posts: 34 izah_2 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 2 m 48 sec
Reputation Power: 4
i know where is the problem now...it is in my query..i have to query data from two different table..so it won;t work..but i have to query different data from this two table to export in excel ...

this is my query ..


<CFQUERY NAME="qSearch" DATASOURCE="#REQUEST.DSN#" >
SELECT EDMS_LOGINHISTORY.*, EDMS_USER.USER_LOGIN, EDMS_USER.USER_NAME
FROM EDMS_LOGINHISTORY, EDMS_USER
</cfquery>




so how can i fix it ?i try many ways but it won't work....i have twi table which are EDMS_LOGINHISTORY and EDMS_USER....if i try query from one table, there is no problem..but if i query frorm two table it wont work...help me please...

Reply With Quote
  #4  
Old March 17th, 2005, 10:29 PM
kiteless kiteless is offline
Moderator
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,676 kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 4 Days 15 h 10 m 34 sec
Reputation Power: 53
I'm assuming that you need to read up on SQL. Specifically the option of joining two tables together.

http://www.w3schools.com/sql/sql_join.asp
__________________
Ask if you have a question, but also help answer questions that you have knowledge of! Thanks, Brian.
How to Post a Question in the Forums

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreColdFusion Development > export excel


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway