Solved

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

Posted on 2009-05-15
2
174 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 500 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

When setting up new project requests for our site, one of the most powerful tools our team has available to use is Axure (http://www.axure.com/). It’s a tool for creating software and web prototypes that can function and interact as if it were the a…
Objective of This Article In 1990’s, when I was a budding software professional, I had a lot of confusion about which stream or technology, I had to choose to build my career. In those days, I had lot of confusion like whether to choose System so…
The purpose of this video is to demonstrate how to insert an Iframe into WordPress. This will be demonstrated using a Windows 8 PC. Go to your WordPress login page. This will look like the following: mywebsite.com/wp-login.php : Open Page or Post…
The purpose of this video is to demonstrate how to update a WordPress Site’s version. WordPress releases new versions of its software frequently and it is important to update frequently in order to keep your site secure, and to get new WordPress…

739 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