?
Solved

How do i create a form by querying the tables collumn names, I think i am close.

Posted on 2009-05-15
2
Medium Priority
?
176 Views
Last Modified: 2013-12-24
I am attepting to build a form by looping the collumn names of a query.
I am returning the collumn names, data_types, and max lengths I am getting this error.
The most likely cause of the error is that you are trying to use a complex value as a simple one. For example, you might be trying to use a query variable in a cfif tag.

I am stumped.

God bless.
<cfquery datasource = "#dsn#" name="thequery">
select column_name as collumnName, data_type as dataType, character_maximum_length as maxlength from information_schema.columns
where table_name = 'myTable'
</cfquery>
 
<body>
<cfoutput>
<cfdump var="#thequery#">
</cfoutput> <!---  This successfully returns all collumn names , data_types and max lengths --->
<cfform target="_self" method="post" preloader="no">
<cfloop query="#thequery#"> <!---  I get the error at this line of code ---> 
<cfif datatype EQ "nvarchar">
<cfoutput>
<cfinput type="text" name="#CollumnName#" maxlength="#maxlength#" label="#collumnName# #datatype#">
</cfoutput>
</cfif>
</cfloop>
 
 
</cfform><!------>

Open in new window

0
Comment
Question by:LeadCo
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 52

Accepted Solution

by:
_agx_ earned 2000 total points
ID: 24397369
> <cfloop query="#thequery#"> <!---  I get the error at this line of code --->

Do not use # signs. The value should be a string (ie the name of your query).  

         <cfloop query="thequery">

When you use # signs, you are passing in the query _object_ which is a complex object (ie not what cfloop is expecting).
0
 

Author Closing Comment

by:LeadCo
ID: 31581917
Thanks.
0

Featured Post

Portable, direct connect server access

The ATEN CV211 connects a laptop directly to any server allowing you instant access to perform data maintenance and local operations, for quick troubleshooting, updating, service and repair.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hi. There are several upload tutorials using jquery and coldfusion. I found a very interesting one here Upload Your Files using Jquery & ColdFusion and Preview them (http://www.randhawaworld.com/) . I did keep the main js functions but made sever…
If you don't have the right permissions set for your WordPress location in IIS, you won't be able to perform automatic updates. Here's how to fix the problem.
The purpose of this video is to demonstrate how to make a WordPress Site faster and smaller in size by cleaning up the database. This will be demonstrated using a Windows 8 PC. Plugin WP Optimize will be used. Go to your WordPress login page. T…
The purpose of this video is to demonstrate how to set up an RSS Feed on a WordPress Website. This will be demonstrated using a Windows 8 PC. Feedburner will be used for this demonstration. Go to your WordPress login page. This will look like the…

719 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question