Received: from localhost (maia-2.hub.org [200.46.204.187]) by postgresql.org (Postfix) with ESMTP id 276D29FB2A2 for ; Tue, 20 Mar 2007 10:25:22 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.187]) (amavisd-new, port 10024) with ESMTP id 55261-05 for ; Tue, 20 Mar 2007 10:25:11 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from interscan.indicator.com (mail.indicator.be [193.121.199.3]) by postgresql.org (Postfix) with ESMTP id 33EFB9FB2E3 for ; Tue, 20 Mar 2007 10:25:12 -0300 (ADT) Received: from webaccess.indicator.be ([10.100.1.7]) by interscan.indicator.com with InterScan Message Security Suite; Tue, 20 Mar 2007 14:12:16 +0100 Received: from DOMEXT-MTA by webaccess.indicator.bewith Novell_GroupWise; Tue, 20 Mar 2007 14:25:11 +0100 Message-Id: <45FFEEBD.A3DD.0030.0@indicator.be> X-Mailer: Novell GroupWise Internet Agent 7.0.1 Date: Tue, 20 Mar 2007 14:25:01 +0100 From: "Bart Degryse" To: Cc: "Shavonne Marietta Wijesinghe" Subject: Re: Select and Count References: <005701c76ad8$8c4c7690$1102a8c0@dream> In-Reply-To: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="=__Part8FAB38BD.0__=" X-imss-version: 2.046 X-imss-result: Passed X-imss-approveListMatch: *@indicator.be X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.302 tagged_above=0 required=5 tests=AWL, BAYES_50, FORGED_RCVD_HELO, HTML_50_60, HTML_MESSAGE, UNPARSEABLE_RELAY X-Spam-Level: X-Archive-Number: 200703/273 X-Sequence-Number: 27911 --=__Part8FAB38BD.0__= Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit Don't know any ASP but maybe Response.Write only accepts strings. In that case you would need to do something like <% Response.Write cStr(sch_sin) %> Maybe you can let the database do the summing: <% option explicit %> <% Dim strSQL Dim oRs Dim oConn oConn = ... 'Fill this in for yourself strSQL = "SELECT COUNT(SCHE_SINGOLA) COU, SUM(SCHE_SINGOLA) SU FROM " & MioTabella & " WHERE TRIM(date_inserted) >= '" & datainizio & "' AND TRIM(date_inserted) <= '" & datafine & "'" oRs.open strSQL,oConn,3 If oRs.RecordCount = 1 Then Response.Write(oRs("COU")) Response.Write(oRs("SU")) Else Response.Write("Something went wrong") End If %> >>> Martin Marques 2007-03-20 12:55 >>> On Tue, 20 Mar 2007, Shavonne Marietta Wijesinghe wrote: > Hello > > I have a postgresql table and i do a select via ASP > > strSQL = "SELECT * FROM " & MioTabella & " WHERE TRIM(date_inserted) >= '" & datainizio & "' AND TRIM(date_inserted) <= '" & datafine & "'" > > oRs.open strSQL,oConn,3 > schede = oRs.RecordCount > > Do until oRs.EOF > sch_sin = cint(sch_sin) + cint(oRs("SCHE_SINGOLA").Value) > oRs.movenext > Loop I know nothing about ASP, but it looks like you are doing a SUM of an int with, maybe, an array (don't know how ASP defines oRs().Value output). Keep in mind that you are pulling all the columns of that table (as you used a * in the column selection). Just a guess, nothing more then that. -- 21:50:04 up 2 days, 9:07, 0 users, load average: 0.92, 0.37, 0.18 --------------------------------------------------------- Lic. Martín Marqués | SELECT 'mmarques' || Centro de Telemática | '@' || 'unl.edu.ar'; Universidad Nacional | DBA, Programador, del Litoral | Administrador --------------------------------------------------------- ---------------------------(end of broadcast)--------------------------- TIP 2: Don't 'kill -9' the postmaster --=__Part8FAB38BD.0__= Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit Content-Description: HTML
Don't know any ASP but maybe Response.Write only accepts strings. In that case you would need to do something like
<%
 Response.Write cStr(sch_sin)
%>
 
Maybe you can let the database do the summing:
 
<% option explicit %>
<%
  Dim strSQL
  Dim oRs
  Dim oConn
 
  oConn = ... 'Fill this in for yourself
 
  strSQL = "SELECT COUNT(SCHE_SINGOLA) COU, SUM(SCHE_SINGOLA) SU FROM " & MioTabella & " WHERE TRIM(date_inserted) >= '" & datainizio & "' AND TRIM(date_inserted) <= '" & datafine & "'"
 
  oRs.open strSQL,oConn,3
 
  If oRs.RecordCount = 1 Then
    Response.Write(oRs("COU"))
    Response.Write(oRs("SU"))
  Else
    Response.Write("Something went wrong")
  End If
%>

>>> Martin Marques <martin@bugs.unl.edu.ar> 2007-03-20 12:55 >>>
On Tue, 20 Mar 2007, Shavonne Marietta Wijesinghe wrote:

> Hello
>
> I have a postgresql table and i do a select via ASP
>
> strSQL = "SELECT * FROM " & MioTabella & " WHERE TRIM(date_inserted) >= '" & datainizio & "' AND TRIM(date_inserted) <= '" & datafine & "'"
>
> oRs.open strSQL,oConn,3
> schede = oRs.RecordCount
>
> Do until oRs.EOF
> sch_sin = cint(sch_sin) + cint(oRs("SCHE_SINGOLA").Value)
> oRs.movenext
> Loop

I know nothing about ASP, but it looks like you are doing a SUM of an int
with, maybe, an array (don't know how ASP defines oRs().Value output).

Keep in mind that you are pulling all the columns of that table (as you
used a * in the column selection).

Just a guess, nothing more then that.

--
  21:50:04 up 2 days,  9:07,  0 users,  load average: 0.92, 0.37, 0.18
---------------------------------------------------------
Lic. Martín Marqués         |   SELECT 'mmarques' ||
Centro de Telemática        |       '@' || 'unl.edu.ar';
Universidad Nacional        |   DBA, Programador,
     del Litoral             |   Administrador
---------------------------------------------------------
---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster
--=__Part8FAB38BD.0__=--