I have another question about sql tables and columns. Besides the table
names, I also need to be able to get at the column names in an Access
database. The folowing code works, until I get a table with no data in it,
which yields a 37000 ODBC error. I've looked through Access system tables
and SQL references, but can't find out how to get column names within a
table. Someone please tell me what I am missing.

Thanks again,

Ryan Block
 

<cfif IsDefined("tablename") IS "No">
        Click the back button on your browser and select a valid table name.
        <cfabort>       
</cfif>

<cfquery name="getcolumns" datasource="#Client.dbname#">
SELECT TOP 1 * <!--- Need to fix and just get one record or find other
solution to get column names --->
FROM #tablename#
</cfquery>

<cfoutput><font size="+1">Below is a list of columns in the #tablename#
table.</font><br><br>
Uncheck any columns that you do not want displayed on the next screen.<br>
You may also enter a new column name that will be used when diplaying data
within this application.<br><br></cfoutput>
<!--- <form action="tableorfields.cfm" method="post"> Change to this later
--->
<form action="showdata.cfm" method="post">
<table>

<CFLOOP INDEX="ColumnName" LIST="#getcolumns.ColumnList#">
        <CFOUTPUT>
                <tr>
                        <td><input type="checkbox" name="c#ColumnName#"
value="" checked></td>
                        <td>#ColumnName#</td>
                        <td><input type="text" name="t#ColumnName#"></td>
                </tr>
        </CFOUTPUT>
</CFLOOP>
</table>

<br>
<input type="submit" value="Display Data"> <input type="Reset">
</form>


</body>
</html>


-----Original Message-----
From: Bryan LaPlante [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, May 15, 2001 11:48 AM
To: [EMAIL PROTECTED]
Subject: Re: [KCFusion] SQL table listing


If you want to look at all the object in the DB here is a little dynamic
table for doing that.

<CFQUERY NAME="QryResult" DATASOURCE="" MAXROWS="" DBTYPE="ODBC">
select * from msysobjects
</CFQUERY>
<TABLE>
 <TR>
  <CFLOOP INDEX="ColumnName" LIST="#QryResult.ColumnList#" DELIMITERS=",">
  <TD><CFOUTPUT>#ColumnName#</CFOUTPUT></TD>
  </CFLOOP>
 <CFOUTPUT QUERY="QryResult">
 </TR>
 <TR>
 <CFLOOP INDEX="CellValue" LIST="#QryResult.ColumnList#" DELIMITERS=",">
  <TD>#Evaluate("QryResult." & "#CellValue#")#</TD>
 </CFLOOP>
 </CFOUTPUT>
 </TR>
</TABLE>

----- Original Message -----
From: "Ryan Block" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, May 15, 2001 11:01 AM
Subject: [KCFusion] SQL table listing


> I can't remember how to query a database to just return the names of the
> tables in a  database (just using Access for now). I know that I have seen
> the syntax to do this somewhere, but can't find it. Thanks in advance.
>
> Ryan Block
>
>
> ______________________________________________________________________
> The KCFusion.org list and website is hosted by Humankind Systems, Inc.
> List Archives........ http://www.mail-archive.com/cf-list@kcfusion.org
> Questions, Comments or Glowing Praise.. mailto:[EMAIL PROTECTED]
> To Subscribe.................... mailto:[EMAIL PROTECTED]
> To Unsubscribe................ mailto:[EMAIL PROTECTED]
>
>

 
 
______________________________________________________________________
The KCFusion.org list and website is hosted by Humankind Systems, Inc.
List Archives........ http://www.mail-archive.com/cf-list@kcfusion.org
Questions, Comments or Glowing Praise.. mailto:[EMAIL PROTECTED]
To Subscribe.................... mailto:[EMAIL PROTECTED]
To Unsubscribe................ mailto:[EMAIL PROTECTED]
 
 
 
______________________________________________________________________
The KCFusion.org list and website is hosted by Humankind Systems, Inc.
List Archives........ http://www.mail-archive.com/cf-list@kcfusion.org
Questions, Comments or Glowing Praise.. mailto:[EMAIL PROTECTED]
To Subscribe.................... mailto:[EMAIL PROTECTED]
To Unsubscribe................ mailto:[EMAIL PROTECTED]
 

Reply via email to