Solved

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

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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

One of the typical problems I have experienced is when you have to move a web server from one hosting site to another. You normally prepare all on the new host, transfer the site, change DNS and cross your fingers hoping all will be ok on new server…
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 add AdSense Ads to a WordPress Website, and how to set up WordPress to automatically place Ads in Sidebars. This will be demonstrated using a Windows 8 PC. Log into your AdSense account. : Cli…
The purpose of this video is to demonstrate how to Import and export files in 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 : Click on Too…

743 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now