Ask a Question related to Coldfusion Database Access, Design and Development.
-
KriZzZz #1
Passing database column names as varable
I've tried all night to figure this one out..And I can't seem to find the
answear on the forums..
I've made a CustomTag-file that need these attributes:
KRISGRAPH.CFM:
<CFPARAM NAME="Attributes.Database_ColumnName">
<CFPARAM NAME="Attributes.DATASOURCE">
<CFPARAM NAME="Attributes.TABLE">
And then I pass the ColumnName to the CustomTag with these attribute values:
INDEX.CFM:
<CF_KRISGRAPH
DATASOURCE="MYFIRM"
TABLE="Customers"
Database_ColumnName="Customer_Name"And then i want to output the particular column values from>
#Attributes.Database_ColumnName#
<cfquery name="Graph_01" datasource="#Attributes.DATASOURCE#">
SELECT * FROM #Attributes.TABLE#
</cfquery>
<cfoutput query="Graph_01">
#Attributes.Database_ColumnName#, <br>
</cfoutput>
The result is ofcourse only the Customer_Name and not the value of it...:
Customer_Name,
Customer_Name,
Customer_Name,
Customer_Name,
I understand why it does it, but how can i get around it and nicly output the
value of it instead?
Cheers!
KriZzZz Guest
-
Getting column data without column names
Hello all, I'm trying to write a coldfusion program to display account data such as name, address, phone #, etc. I retrieve this data from an ... -
counting column and getting column names
Im using an Access database that will probably be switched over to Oracle later, but I need to find out how to get the number of columns in an... -
HELP! Passing from database to asp page allowing user input then passing to another database.
My big problem is I'm a newbie working with someone else's code.(See code below) What I want to do is for the records that have a purchase order... -
How to get column names using SQL?
In article <a06d6e69.0307100719.2e206e69@posting.google.com>, minjie@excite.com says... SYSCAT.COLUMNS To show the columns of this view: ... -
No column names
Hi, Change the value of DESCSTAT from NO to YES and reassemble DSNZPARM. Vesna Frank wrote: -
BKBK #2
Re: Passing database column names as varable
<CFPARAM NAME="Attributes.Database_ColumnName">
<CFPARAM NAME="Attributes.DATASOURCE">
<CFPARAM NAME="Attributes.TABLE">
is not necessarily wrong. However, it's the usual practice to set the default
values, thus
<CFPARAM NAME="Attributes.Database_ColumnName" DEFAULT="Customer_Name">
<CFPARAM NAME="Attributes.DATASOURCE" DEFAULT="MYFIRM">
<CFPARAM NAME="Attributes.TABLE" DEFAULT="Customers">
<!--- Use query's structure-key format to identify each row, and iterate by> how can i get around it and nicly output the value of it instead?
means of in-built variable, currentrow --->
<cfoutput query="Graph_01">
#Graph_01#, <br>
</cfoutput>
BKBK Guest
-
Dan Bracuk #3
Re: Passing database column names as varable
Your custom tag will run more quickly if you select only attributes.column_name instead of *.
Dan Bracuk Guest
-
KriZzZz #4
Re: Passing database column names as varable
Thank you so much! Love you!
BKBK: Yeah, my bad, but i only narrowed the code here to focus on the actual
problem i had. But the default values are going in there right this second. :)
It worked perfectly, but I haven't seen that particular code before. Im quite
on the "getting-started"-level of my coding.. As i translate it to my level of
understanding, the is a variable in cold fusion that picks out a new row
inside the loop..sort of? very neat :)
Dan: Yeah. again, just to focus on the problem, so i did a fast example.
Thanks again, both you!
KriZzZz Guest



Reply With Quote

