Hi, thank you, I think maybe the way I am posting questions is not clear,
what I meant is to get the number <sql:rowCount/> and put it in a variable,
so for example if there is a row I will update it, if not I will add it, the
way they are showing in there examples is only for display.

thanks


>From: Richard Yee <[EMAIL PROTECTED]>
>Reply-To: A mailing list about Java Server Pages specification and
>reference <[EMAIL PROTECTED]>
>To: [EMAIL PROTECTED]
>Subject: Re: how to use wasEmpt and rowCount of DBtaglib ??
>Date: Tue, 21 May 2002 17:59:44 -0700
>
>Sufi,
>
>This was from the link I sent you:
>
>"wasEmpty" and "wasNotEmpty" tags
>
>The "wasEmpty" tag only executes its body if the last ResultSet tag
>received 0 rows from the database. You must be after a resultSet tag, or an
>error will be generated. The "wasNotEmpty" tag executes its body if the
>last ResultSet received more than 0 rows from the database. See the Tag
>Reference for examples.
>
>"rowCount" tag
>
>The "rowCount" tag prints out the number of rows retrieved from the
>database. It can be used inside a ResultSet tag to provide a running count
>of rows retreived, or after the ResultSet tag to display the total number.
>See the Tag Reference for examples. Using the tag before the ResultSet will
>produce an error.
>
>
>wasEmpty  Availability: 1.0
>
>Executes its body if the last ResultSet tag received 0 rows from the
>database. You must be after a ResultSet tag, or an error will be generated.
>Tag Body JSP
>Restrictions
>
>Use after a ResultSet tag.
>Attributes None
>Variables None
>Examples
>
>
>
>
><%-- showing the contents of the table --%>
><table>
><tr><th>id</th><th>name</th><th>description</th></tr>
><sql:preparedStatement id="stmt6" conn="conn1"> <sql:query>
>select id, name, description from test_books
>   </sql:query>
><sql:resultSet id="rset4">
><tr>
><td><sql:getColumn position="1"/></td>
><td><sql:getColumn position="2"/></td>
><td><sql:getColumn position="3" to="description"/></td>
></tr>
></sql:resultSet>
><tr>
><td colspan="3">
><%-- show different text, depending on whether or not
>     any rows were retrieved --%>
><sql:wasEmpty>No rows retrieved.</sql:wasEmpty>
><sql:wasNotEmpty><sql:rowCount/> rows retrieved.</sql:wasNotEmpty>
></td>
></tr>
></sql:preparedStatement>
>
>wasNotEmpty Availability: 1.0
>
>Executes its body if the last ResultSet tag received more than 0 rows from
>the database. You must be after a ResultSet tag, or an error will be
>generated.
>Tag Body JSP
>Restrictions
>
>Use after a ResultSet tag.
>Attributes None
>Variables None
>Examples
>
>
>
>
><%-- showing the contents of the table --%>
><table>
><tr><th>id</th><th>name</th><th>description</th></tr>
><sql:preparedStatement id="stmt6" conn="conn1"> <sql:query>
>select id, name, description from test_books
>   </sql:query>
><sql:resultSet id="rset4">
><tr>
><td><sql:getColumn position="1"/></td>
><td><sql:getColumn position="2"/></td>
><td><sql:getColumn position="3" to="description"/></td>
></tr>
></sql:resultSet>
><tr>
><td colspan="3">
><%-- show different text, depending on whether or not
>     any rows were retrieved --%>
><sql:wasEmpty>No rows retrieved.</sql:wasEmpty>
><sql:wasNotEmpty><sql:rowCount/> rows retrieved.</sql:wasNotEmpty>
></td>
></tr>
></sql:preparedStatement>
>
>rowCount Availability: 1.0
>
>Prints out the number of rows retrieved from the database. It can be used
>inside a ResultSet tag to provide a running count of rows retreived, or
>after the ResultSet tag to display the total number. Using the tag before
>the ResultSet will produce an error.
>Tag Body empty
>Restrictions
>
>Use inside or after a ResultSet tag (not before).
>Attributes None
>Variables None
>Examples
>
>
>
>
><%-- showing the contents of the table --%>
><table>
><tr><th>id</th><th>name</th><th>description</th></tr>
><sql:preparedStatement id="stmt6" conn="conn1"> <sql:query>
>select id, name, description from test_books
>   </sql:query>
><sql:resultSet id="rset4">
><tr>
><td><sql:getColumn position="1"/></td>
><td><sql:getColumn position="2"/></td>
><td><sql:getColumn position="3" to="description"/></td>
></tr>
></sql:resultSet>
><tr>
><td colspan="3">
><%-- show different text, depending on whether or not
>     any rows were retrieved --%>
><sql:wasEmpty>No rows retrieved.</sql:wasEmpty>
><sql:wasNotEmpty><sql:rowCount/> rows retrieved.</sql:wasNotEmpty>
></td>
></tr>
></sql:preparedStatement>
>
>
>It shows how to use wasEmpty and rowCount if you look at the examples.
>
>Regards,
>
>Richard
>
>
>At 12:54 AM 5/22/2002 +0000, you wrote:
>>Hi,
>>No that was for wasNull, what I am asking for is rowCount and wasEmpty.
>>thank you anyway.
>
>===========================================================================
>To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
>JSP-INTEREST".
>For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
>DIGEST".
>Some relevant FAQs on JSP/Servlets can be found at:
>
>http://archives.java.sun.com/jsp-interest.html
>http://java.sun.com/products/jsp/faq.html
>http://www.esperanto.org.nz/jsp/jspfaq.jsp
>http://www.jguru.com/faq/index.jsp
>http://www.jspinsider.com




_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp.

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://archives.java.sun.com/jsp-interest.html
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.jsp
 http://www.jguru.com/faq/index.jsp
 http://www.jspinsider.com

Reply via email to