Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

HELP Please ... Returning a query from CFX Tag 1

Status
Not open for further replies.

Komil13

Programmer
Joined
Sep 26, 2001
Messages
50
Location
US
Hi,

I was wondering how to return a query from a CFX tag. I looked at the CFDocs and tried the examples, but it didn't work. Any help would be beneficial.

Thanks....
 
tha cfx tag returns predetermined values that are specified by whoever wrote that cfx tag; you have to check the tag documentation and see what would be the variable names that are returning values you can use;

for example:

the <cf_browser> tag will return the browser values in the form &quot;browserType&quot; and &quot;browserVersion&quot;, and that's it.

you will not find that information anywhere else but in the documentation that comes with the tag itself

Sylvano
dsylvano@hotmail.com

&quot;every and each day when I learn something new is a small victory...&quot;
 
Hey,

Thanks for answering. I am writing a CFX tag and I wanted to know how to set a Query inside the tag, add data to it, and return the Query to the calling template.
 
hi Komil13

What language will you be programming the tag in? If you're just talking about referring to CFM files via <CFX_myfile> im not sure there is such a way to simulate a query.

If however you're writing this in C++ there's a way to create a QUERY instance:

// create a CF query object called NEWQUERY, then add one empty row
CCFXQuery *query = req->AddQuery(&quot;NEWQUERY&quot;, &quot;FirstName,LastName&quot;);
int row = query->AddRow();

//run an update for row:1 column:FirstName
query->SetData(1, &quot;FirstName&quot;, &quot;Jack&quot;);

//run an update for row:1 column:LastName
query->SetData(1, &quot;LastName&quot;, &quot;Black&quot;);

Im not a C programmer but this is pretty basic. Hope this helps, let me know if you get it to compile, and are able to add this CFX tag.

nic
 
hey strantheman,

thanks for your help .... i did find some sample code in coldfusion docs, but it wasn't enough ... the problem i was having was that i didn't know how to initialize the query variable ... the following line from your sample code expains that ...
CCFXQuery *query = req->AddQuery &quot;NEWQUERY&quot;, &quot;FirstName,LastName&quot;);

also, another thing that i found in the docs is that in the following line instead of the column name (i.e. FirstName), you must use the column number, which in this case would be 1.

query->SetData(1, &quot;FirstName&quot;, &quot;Jack&quot;);

your code did help me out .... thanks ....

oh ... and it did compile ....

 
thanks for your help .... i did find some sample code in coldfusion docs, but it wasn''t enough ... the problem i was having was that i didn''t know how to initialize the query variable ... the following line from your sample code expains that ...
CCFXQuery *query = req->AddQuery &quot;NEWQUERY&quot;, &quot;FirstName,LastName&quot;);

also, another thing that i found in the docs is that in the following line instead of the column name (i.e. FirstName), you must use the column number, which in this case would be 1.

query->SetData(1, &quot;FirstName&quot;, &quot;Jack&quot;);

your code did help me out .... thanks ....

oh ... and it did compile ....
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top