Re: Re[2]: getRowCount()
much easier query is: "select count(1) as totalRecordsField from foo" From: "Matthew L. Wright" [EMAIL PROTECTED] Reply-To: [EMAIL PROTECTED] To: JRun-Talk [EMAIL PROTECTED] Subject: Re: Re[2]: getRowCount() Date: Fri, 30 Mar 2001 16:45:06 -0800 Also, in case you have many records you're pulling up yo may not want to cycle through all of them. Use: "Select count(*) as totalRecordsField from foo" and then pull the value of the "totalRecordsField". This is a easier query on the DB as you need not deal with the cursor as much. Matt Matthew L. Wright Java Internet Programmer Jupiter One Web World Studios West Coast www.jupiterone.com (818) 763-2927 - Original Message - From: "Moore, Jim" [EMAIL PROTECTED] To: "JRun-Talk" [EMAIL PROTECTED] Sent: Friday, March 30, 2001 12:36 PM Subject: RE: Re[2]: getRowCount() String sql = "SELECT * FROM foo"; Statement stmt = conn.createStatement(); ResultSet rs = stmt.executeQuery(sql); int rowcount = rs.getRow(); rs.beforeFirst(); while (rs.next()) { file://process resultset } or String sql = "SELECT * FROM foo"; Statement stmt = conn.createStatement(); ResultSet rs = stmt.executeQuery(sql); int rowcount = 0; while (rs.next()) { file://process resultset rowcount++; } --jim -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Friday, March 30, 2001 3:13 PM To: JRun-Talk Subject: Re[2]: getRowCount() Additional Header Information: Received: from www.houseoffusion.com ([207.31.122.140]) by inside.pgi.com (Lotus SMTP MTA v4.6.6 (890.1 7-16-1999)) with SMTP id 85256A1F.006958EB; Fri, 30 Mar 2001 14:10:40 -0500 Received: from houseoffusion.com ([207.31.122.140]) by www.houseoffusion.com (Post.Office MTA v3.5.3 release 223 ID# 0-54969U100L100S0V35) with ESMTP id com for [EMAIL PROTECTED]; Fri, 30 Mar 2001 13:56:17 -0500 Content-type: text/plain Content-type: text/plain Date: Fri, 30 Mar 2001 13:42:43 -0500 From: [EMAIL PROTECTED] Message-id: 3312CFEA8474D411BAB600508B9587B21CE785@S0001EXC0007 Subject: RE: getRowCount() Reply-To: [EMAIL PROTECTED] To: JRun-Talk [EMAIL PROTECTED] - if I don't use allaire tag, how can I get the recordcount after I ran a query? thank you YC %@ page import='allaire.taglib.*' % j:sql datasrc='...' id='result' j:sql % QueryTable t = (QueryTable)pageContext.getAttribute("result"); out.print(t.getRowCount()); % In JRun 3.1 (currently in beta), you should be able to treat the query object like javax.sql.RowSet. -C -- Clement Wong JRun Engineer, Macromedia http://www.macromedia.com ~~ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm Archives: http://www.mail-archive.com/jrun-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
RE: getRowCount()
%@ page import='allaire.taglib.*' % j:sql datasrc='...' id='result' j:sql % QueryTable t = (QueryTable)pageContext.getAttribute("result"); out.print(t.getRowCount()); % In JRun 3.1 (currently in beta), you should be able to treat the query object like javax.sql.RowSet. -C -- Clement Wong JRun Engineer, Macromedia http://www.macromedia.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Friday, March 30, 2001 12:06 PM To: JRun-Talk Subject: getRowCount() Additional Header Information: Received: from www.houseoffusion.com ([207.31.122.140]) by inside.pgi.com (Lotus SMTP MTA v4.6.6 (890.1 7-16-1999)) with SMTP id 85256A1F.005B3AFA; Fri, 30 Mar 2001 11:36:28 -0500 Received: from houseoffusion.com ([207.31.122.140]) by www.houseoffusion.com (Post.Office MTA v3.5.3 release 223 ID# 0-54969U100L100S0V35) with ESMTP id com for [EMAIL PROTECTED]; Fri, 30 Mar 2001 11:24:07 -0500 Content-type: text/plain Content-type: text/plain Date: Fri, 30 Mar 2001 11:15:18 -0500 From: Ed Apostol [EMAIL PROTECTED] Message-id: [EMAIL PROTECTED] Subject: correction Reply-To: [EMAIL PROTECTED] To: JRun-Talk [EMAIL PROTECTED] - Hi Eveyone, Does anyone knows how to get getRowCount() after I ran a query? JRun tag, sql does support getRowCount(), If I don't use JRun's sql tag, how can I get the recordcount after i ran a query? Where can I find what else method does JRun sql tag support? Thank you YC ~~ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm Archives: http://www.mail-archive.com/jrun-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
Re: getRowCount()
htmlhead/headbodyfont face="Courier New, Courier, mono"yc, it's funny you ask because I just went thru the same.nbsp; The answer is in your std java doc 'jdbc getting started guide' under:/fontbr br font face="Courier New, Courier, mono"5.1.4Determining the Number of Rows in a Result Set/fontbr br BenG.br br a class="moz-txt-link-abbreviated" href="mailto:[EMAIL PROTECTED]"[EMAIL PROTECTED]/a wrote:br blockquote type="cite" cite="[EMAIL PROTECTED]">mid:[EMAIL PROTECTED]"pre wrap=""brbrAdditional Header Information:brReceived: from a class="moz-txt-link-abbreviated" href="http://www.houseoffusion.com"www.houseoffusion.com/a ([207.31.122.140]) by inside.pgi.com (LotusbrSMTP MTA v4.6.6 (890.1 7-16-1999)) with SMTP id 85256A1F.005B3AFA; Fri, 30 Marbr2001 11:36:28 -0500brReceived: from houseoffusion.com ([207.31.122.140])br by a class="moz-txt-link-abbreviated" href="http://www.houseoffusion.com"www.houseoffusion.com/a (Post.Office MTA v3.5.3brrelease 223br ID# 0-54969U100L100S0V35) with ESMTP id combr for a class="moz-txt-link-rfc2396E" href="mailto:[EMAIL PROTECTED]"lt;[EMAIL PROTECTED]gt;/a;br Fri, 30 Mar 2001 11:24:07 -0500brContent-type: text/plainbrContent-type: text/plainbrDate: Fri, 30 Mar 2001 11:15:18 -0500brFrom: Ed Apostol a class="moz-txt-link-rfc2396E" href="mailto:[EMAIL PROTECTED]"lt;[EMAIL PROTECTED]gt;/abrMessage-id:bra class="moz-txt-link-rfc2396E" href="[EMAIL PROTECTED]">mailto:[EMAIL PROTECTED]"lt;[EMAIL PROTECTED]gt;/abrSubject: correctionbrReply-To: a class="moz-txt-link-abbreviated" href="mailto:[EMAIL PROTECTED]"[EMAIL PROTECTED]/abrTo: JRun-Talk a class="moz-txt-link-rfc2396E" href="mailto:[EMAIL PROTECTED]"lt;[EMAIL PROTECTED]gt;/abrbrbr-brbrbrbrbrbrHi Eveyone,brDoes anyone knows how to get getRowCount() after I ran a query?brJRun tag, sql does support getRowCount(), If I don't use JRun's sql tag, how canbrI get the recordcount after i ran a query?brbrWhere can I find what else method does JRun sql tag support?brbrThank youbrbrYCbr ~~ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm Archives: http://www.mail-archive.com/jrun-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
Re[2]: getRowCount()
Additional Header Information: Received: from www.houseoffusion.com ([207.31.122.140]) by inside.pgi.com (Lotus SMTP MTA v4.6.6 (890.1 7-16-1999)) with SMTP id 85256A1F.006958EB; Fri, 30 Mar 2001 14:10:40 -0500 Received: from houseoffusion.com ([207.31.122.140]) by www.houseoffusion.com (Post.Office MTA v3.5.3 release 223 ID# 0-54969U100L100S0V35) with ESMTP id com for [EMAIL PROTECTED]; Fri, 30 Mar 2001 13:56:17 -0500 Content-type: text/plain Content-type: text/plain Date: Fri, 30 Mar 2001 13:42:43 -0500 From: [EMAIL PROTECTED] Message-id: 3312CFEA8474D411BAB600508B9587B21CE785@S0001EXC0007 Subject: RE: getRowCount() Reply-To: [EMAIL PROTECTED] To: JRun-Talk [EMAIL PROTECTED] - if I don't use allaire tag, how can I get the recordcount after I ran a query? thank you YC %@ page import='allaire.taglib.*' % j:sql datasrc='...' id='result' j:sql % QueryTable t = (QueryTable)pageContext.getAttribute("result"); out.print(t.getRowCount()); % In JRun 3.1 (currently in beta), you should be able to treat the query object like javax.sql.RowSet. -C -- Clement Wong JRun Engineer, Macromedia http://www.macromedia.com ~~ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm Archives: http://www.mail-archive.com/jrun-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
RE: Re[2]: getRowCount()
String sql = "SELECT * FROM foo"; Statement stmt = conn.createStatement(); ResultSet rs = stmt.executeQuery(sql); int rowcount = rs.getRow(); rs.beforeFirst(); while (rs.next()) { //process resultset } or String sql = "SELECT * FROM foo"; Statement stmt = conn.createStatement(); ResultSet rs = stmt.executeQuery(sql); int rowcount = 0; while (rs.next()) { //process resultset rowcount++; } --jim -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Friday, March 30, 2001 3:13 PM To: JRun-Talk Subject: Re[2]: getRowCount() Additional Header Information: Received: from www.houseoffusion.com ([207.31.122.140]) by inside.pgi.com (Lotus SMTP MTA v4.6.6 (890.1 7-16-1999)) with SMTP id 85256A1F.006958EB; Fri, 30 Mar 2001 14:10:40 -0500 Received: from houseoffusion.com ([207.31.122.140]) by www.houseoffusion.com (Post.Office MTA v3.5.3 release 223 ID# 0-54969U100L100S0V35) with ESMTP id com for [EMAIL PROTECTED]; Fri, 30 Mar 2001 13:56:17 -0500 Content-type: text/plain Content-type: text/plain Date: Fri, 30 Mar 2001 13:42:43 -0500 From: [EMAIL PROTECTED] Message-id: 3312CFEA8474D411BAB600508B9587B21CE785@S0001EXC0007 Subject: RE: getRowCount() Reply-To: [EMAIL PROTECTED] To: JRun-Talk [EMAIL PROTECTED] - if I don't use allaire tag, how can I get the recordcount after I ran a query? thank you YC %@ page import='allaire.taglib.*' % j:sql datasrc='...' id='result' j:sql % QueryTable t = (QueryTable)pageContext.getAttribute("result"); out.print(t.getRowCount()); % In JRun 3.1 (currently in beta), you should be able to treat the query object like javax.sql.RowSet. -C -- Clement Wong JRun Engineer, Macromedia http://www.macromedia.com ~~ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm Archives: http://www.mail-archive.com/jrun-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
Re: Re[2]: getRowCount()
Also, in case you have many records you're pulling up yo may not want to cycle through all of them. Use: "Select count(*) as totalRecordsField from foo" and then pull the value of the "totalRecordsField". This is a easier query on the DB as you need not deal with the cursor as much. Matt Matthew L. Wright Java Internet Programmer Jupiter One Web World Studios West Coast www.jupiterone.com (818) 763-2927 - Original Message - From: "Moore, Jim" [EMAIL PROTECTED] To: "JRun-Talk" [EMAIL PROTECTED] Sent: Friday, March 30, 2001 12:36 PM Subject: RE: Re[2]: getRowCount() String sql = "SELECT * FROM foo"; Statement stmt = conn.createStatement(); ResultSet rs = stmt.executeQuery(sql); int rowcount = rs.getRow(); rs.beforeFirst(); while (rs.next()) { file://process resultset } or String sql = "SELECT * FROM foo"; Statement stmt = conn.createStatement(); ResultSet rs = stmt.executeQuery(sql); int rowcount = 0; while (rs.next()) { file://process resultset rowcount++; } --jim -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Friday, March 30, 2001 3:13 PM To: JRun-Talk Subject: Re[2]: getRowCount() Additional Header Information: Received: from www.houseoffusion.com ([207.31.122.140]) by inside.pgi.com (Lotus SMTP MTA v4.6.6 (890.1 7-16-1999)) with SMTP id 85256A1F.006958EB; Fri, 30 Mar 2001 14:10:40 -0500 Received: from houseoffusion.com ([207.31.122.140]) by www.houseoffusion.com (Post.Office MTA v3.5.3 release 223 ID# 0-54969U100L100S0V35) with ESMTP id com for [EMAIL PROTECTED]; Fri, 30 Mar 2001 13:56:17 -0500 Content-type: text/plain Content-type: text/plain Date: Fri, 30 Mar 2001 13:42:43 -0500 From: [EMAIL PROTECTED] Message-id: 3312CFEA8474D411BAB600508B9587B21CE785@S0001EXC0007 Subject: RE: getRowCount() Reply-To: [EMAIL PROTECTED] To: JRun-Talk [EMAIL PROTECTED] - if I don't use allaire tag, how can I get the recordcount after I ran a query? thank you YC %@ page import='allaire.taglib.*' % j:sql datasrc='...' id='result' j:sql % QueryTable t = (QueryTable)pageContext.getAttribute("result"); out.print(t.getRowCount()); % In JRun 3.1 (currently in beta), you should be able to treat the query object like javax.sql.RowSet. -C -- Clement Wong JRun Engineer, Macromedia http://www.macromedia.com ~~ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm Archives: http://www.mail-archive.com/jrun-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists