Does it output in order when you just view the cf page? Could it be
something to do with the link into excel. Perhaps it has trouble with some
data types.

-----Original Message-----
From: Winston Sia [mailto:[EMAIL PROTECTED]]
Sent: 02 March 2001 07:33
To: CF-Talk
Subject: cfquery table data with the columns in order


This is a multi-part message in MIME format.

------=_NextPart_000_01A1_01C0A32E.21E43180
Content-Type: text/plain;
        charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

=20
Hi,

Thanks for the info, but I'm afraid it isn't returning columns in =
order... especially for tables with more than five columns..

Below is the sample code that I am currently using.. please make the =
necessary corrections..

<cfquery name=3D"GetData" datasource=3D"#application.ourdsn#" =
dbtype=3D"ODBC">
   select * from tablename
</cfquery>
<htmL>
<body>
<table width=3D"100%" border=3D"1">
  <tr>
     <cfloop index=3D"ColName" list=3D"#GetData.ColumnList#">
     <th><cfoutput>#ColName#</cfoutput></th>
     </cfloop>
  </tr>
<cfoutput query=3D"GetData">
  <tr>
  <cfloop index=3D"ColName" list=3D"#GetData.ColumnList#">
     <td>#Evaluate(ColName)#</td>
  </cfloop>
  </tr>
</cfoutput>
</table>
</body>
</html>

Now, this cfm file is used to GET EXTERNAL DATA using MS EXCEL 2000, via =
the NEW WEB QUERY function of Excel.

Once I enter the cfm file, the Excel runs the URL of the cfm file and =
does the query... after a while, the results or data is outputted in the =
excel sheet perfectly as I wanted it, only that the columns are =
SOMETIMES not in order especially when the table has many columns.

Help will be very much appreciated..

Thanks,
Winston


------=_NextPart_000_01A1_01C0A32E.21E43180
Content-Type: text/html;
        charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content=3D"text/html; charset=3Diso-8859-1" =
http-equiv=3DContent-Type>
<META content=3D"MSHTML 5.00.2919.6307" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff><FONT face=3DArial><FONT face=3DArial>&nbsp;
<DIV>Hi,</DIV>
<DIV>&nbsp;</DIV>
<DIV>Thanks for the info, but I'm afraid it isn't returning columns in =
order...=20
especially for tables with more than five columns..</DIV>
<DIV>&nbsp;</DIV>
<DIV>Below is the sample code that I am currently using.. please make =
the=20
necessary corrections..</DIV>
<DIV>&nbsp;</DIV>
<DIV>&lt;cfquery name=3D"GetData" datasource=3D"#application.ourdsn#"=20
dbtype=3D"ODBC"&gt;<BR>&nbsp;&nbsp; select * from=20
tablename<BR>&lt;/cfquery&gt;<BR>&lt;htmL&gt;<BR>&lt;body&gt;<BR>&lt;tabl=
e=20
width=3D"100%" border=3D"1"&gt;<BR>&nbsp; =
&lt;tr&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;=20
&lt;cfloop index=3D"ColName"=20
list=3D"#GetData.ColumnList#"&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;=20
&lt;th&gt;&lt;cfoutput&gt;#ColName#&lt;/cfoutput&gt;&lt;/th&gt;<BR>&nbsp;=
&nbsp;&nbsp;&nbsp;=20
&lt;/cfloop&gt;<BR>&nbsp; &lt;/tr&gt;<BR>&lt;cfoutput=20
query=3D"GetData"&gt;<BR>&nbsp; &lt;tr&gt;<BR>&nbsp; &lt;cfloop =
index=3D"ColName"=20
list=3D"#GetData.ColumnList#"&gt;<BR>&nbsp;&nbsp;&nbsp;&nbsp;=20
&lt;td&gt;#Evaluate(ColName)#&lt;/td&gt;<BR>&nbsp; =
&lt;/cfloop&gt;<BR>&nbsp;=20
&lt;/tr&gt;<BR>&lt;/cfoutput&gt;<BR>&lt;/table&gt;<BR>&lt;/body&gt;<BR>&l=
t;/html&gt;<BR><BR>Now,=20
this cfm file is used to GET EXTERNAL DATA using MS EXCEL 2000, via the =
NEW WEB=20
QUERY function of Excel.</DIV>
<DIV>&nbsp;</DIV>
<DIV>Once I enter the cfm file, the Excel runs the URL of the cfm file =
and does=20
the query... after a while, the results or data is outputted in the =
excel sheet=20
perfectly as I wanted it, only that the columns are SOMETIMES not in =
order=20
especially when the table has many columns.</DIV>
<DIV>&nbsp;</DIV>
<DIV>Help will be very much appreciated..</DIV>
<DIV>&nbsp;</DIV>
<DIV>Thanks,</DIV>
<DIV>Winston</DIV>
<DIV>&nbsp;</DIV>
<DIV></FONT></DIV></FONT></BODY></HTML>

------=_NextPart_000_01A1_01C0A32E.21E43180--


Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists


**********************************************************************************

The opinions expressed in this E-mail are those  of  the individual  and
not  necessarily  the  company.  This E-mail and  any files transmitted 
with it are confidential and solely for the use of the intended recipients

**********************************************************************************

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to