>From JRun studio help:

Example
This example shows three different uses of the sql tag.

<%@ page import="java.sql.*,javax.sql.*,allaire.taglib.*" %>
<%@ taglib uri="jruntags" prefix="jrun" %>

<%
Class.forName("....").newInstance();
Connection con = DriverManager.getConnection("....");
%>
<jrun:sql connection="<%= con %>" id="q1">
select * from Table1
</jrun:sql>

<jrun:sql driver="..." url="..." id="q2">
select * from Table1
</jrun:sql>

<%-- sql uses java:comp/env/jdbc/dsn1 to lookup a datasource --%>

<jrun:sql datasrc="dsn1" id="q3">
select * from Table1
</jrun:sql>

<%-- you can enumerate the QueryTable by: --%>

<jrun:param id="q3" type="QueryTable"/>
<jrun:foreach item="x" group="<%= q3.Names %>">
<%= x %><br>
</jrun:foreach>

<jrun:foreach group="<%= q3 %>">
<jrun:foreach item="y" group="<%= q3.Values %>">
<%= y %><br>
</jrun:foreach>
</jrun:foreach>

<%-- OR --%>

<jrun:param id="q3" type="QueryTable"/>
<jrun:foreach group="<%= q3 %>">
<%
int count = q3.getColumnCount();
for (int i = 0;i < count;i += 1) {
%>
<%= q3.get(i) %><br>
<%
}
%>
</jrun:foreach>

<%-- OR --%>

<jrun:param id="q3" type="QueryTable"/>
<%
while (q3.next()) {
%>
<jrun:foreach item="y" group="<%= q3.Values %>">
<%= y %><br>
</jrun:foreach>
<%
}
%>

<%-- OR, if you want to use column names... --%>

<jrun:param id="q3" type="QueryTable"/>
<jrun:foreach group="<%= q3 %>">
<%= q3.get("id") %><br>
<%= q3.get("lastname") %><br>
<5= q3.get("firstname") %><br>
</jrun:foreach>

<%-- OR, if you want to use column index... --%>

<jrun:param id="q3" type="QueryTable"/>
<jrun:foreach group="<%= q3 %>">
<%= q3.get(1) %><br>
<%= q3.get(2) %><br>
<5= q3.get(3) %><br>
</jrun:foreach>



-----Original Message-----
From: Rich Tretola [mailto:[EMAIL PROTECTED]] 
Sent: Monday, August 27, 2001 9:45 AM
To: JRun-Talk
Subject: RE: Output

What is the Jrun tag?
Rich

-----Original Message-----
From: Stacy Young [mailto:[EMAIL PROTECTED]]
Sent: Monday, August 27, 2001 9:38 AM
To: JRun-Talk
Subject: RE: Output


There's a JRun tag for it...and one on apache.org (under jarkata) I
believe...


-----Original Message-----
From: Rich Tretola [mailto:[EMAIL PROTECTED]]
Sent: Monday, August 27, 2001 9:36 AM
To: JRun-Talk
Subject: Output

OK I finally got a connection to a sql datasource.

My <jrun:sql> query works fine.

Now how do I output the results of my query?
Is there a tag for this?

Thansk,
Rich
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to