I looked at the custom tags below, but they need a fully qualified path to
the database and must have DAO installed. So I'm still looking for an Access
solution to get just the column names from a table through a cfquery. SELECT
TOP 1 * FROM table, then getting column names using the CF ColumnList works
as long as there is data in the table, but otherwise I get an error. If
anyone has anymore ideas, I would appreciate it.

Ryan Block

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


There are a couple of cfx tags in the DevEx that you can use for this if you
have access to the server to install them.

CFX_TABLE
http://devex.allaire.com/developer/gallery/info.cfm?ID=CA347124-2830-11D4-AA
9700508B94F380&method=Full

CF_TABLEFIELDS
http://devex.allaire.com/developer/gallery/info.cfm?ID=CA347125-2830-11D4-AA
9700508B94F380&method=Full

url's will probably wrap

Bryan

----- Original Message -----
From: "Ryan Block" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, May 17, 2001 11:35 AM
Subject: RE: [KCFusion] SQL table listing


> 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]
>
>

 
 
______________________________________________________________________
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