I grab some stuff out of a URL and pass it to a system query. I then use the
system query to get all the column names for a particular table. I then store
all these into an array. I then want to use the array to grab the field
information from the table I get the column names from. For some reason it
keeps coming back with the array name is not a valid column. Here is the code.

Anyone know why it won't return the values in the fields even though these are
valid column names? Thanks. :confused;



<cfquery name="getDBTablesCResID" datasource="#dbdatalink#"
dbtype="ODBC">SELECT * FROM #getDBName#.dbo.syscolumns where id = (SELECT id
FROM #getDBName#.dbo.sysobjects where xtype = 'U' and name = '#getTBName#')
order by colid ASC</cfquery>

<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td id="intLink"><cfoutput>#getDBName#: #getTBName#</cfoutput></td>
</tr>
</table>

<cfset columnName = ArrayNew(1)>
<cfset i=1>
<table border="0" cellpadding="0" cellspacing="0" id="areas">
<tr>
<cfoutput query="getDBTablesCResID">
<td id="areaHeader">#name#</td>
<cfset columnName[i] = #name#>
<cfset i = i +1>
</cfoutput>
</tr>

<cfquery name="getRecords" datasource="#datalink#" dbtype="ODBC">select *
from #getTBName#</cfquery>

<cfoutput query="getRecords">
<tr id="#iif(currentRow Mod 2, DE ('odd'),DE('even'))#">
<cfloop index="i" from="1" to="#ArrayLen(columnName)#">
<td id="areaHeader">#columnName[i]#</td>
</cfloop>
</tr>
</cfoutput>
</table>