From shavonne.marietta@studioform.it Tue Mar 20 10:14:33 2007 Received: from localhost (maia-1.hub.org [200.46.204.191]) by postgresql.org (Postfix) with ESMTP id 57D9C9FB2A7 for ; Tue, 20 Mar 2007 07:14:33 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.191]) (amavisd-new, port 10024) with ESMTP id 07394-07 for ; Tue, 20 Mar 2007 07:14:26 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from smtpout22.attiva.biz (smtpout22.attiva.biz [85.37.16.9]) by postgresql.org (Postfix) with ESMTP id 383189FB2A5 for ; Tue, 20 Mar 2007 07:14:25 -0300 (ADT) Received: from FBCMFE02B08.fbc.local ([192.168.30.96]) by smtpout22.attiva.biz with Microsoft SMTPSVC(6.0.3790.1830); Tue, 20 Mar 2007 11:14:23 +0100 Received: from dream ([88.34.161.130]) by FBCMFE02B08.fbc.local with Microsoft SMTPSVC(6.0.3790.1830); Tue, 20 Mar 2007 11:14:23 +0100 Message-ID: <005701c76ad8$8c4c7690$1102a8c0@dream> Reply-To: "Shavonne Marietta Wijesinghe" From: "Shavonne Marietta Wijesinghe" To: Subject: Select and Count Date: Tue, 20 Mar 2007 11:14:29 +0100 Organization: Studio FORM MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_0054_01C76AE0.EDBB1D70" X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2900.3028 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3028 X-OriginalArrivalTime: 20 Mar 2007 10:14:23.0454 (UTC) FILETIME=[883D2FE0:01C76AD8] X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.311 tagged_above=0 required=5 tests=AWL, BAYES_50, HTML_MESSAGE X-Spam-Level: X-Archive-Number: 200703/270 X-Sequence-Number: 27908 This is a multi-part message in MIME format. ------=_NextPart_000_0054_01C76AE0.EDBB1D70 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hello I have a postgresql table and i do a select via ASP strSQL =3D "SELECT * FROM " & MioTabella & " WHERE TRIM(date_inserted) = >=3D '" & datainizio & "' AND TRIM(date_inserted) <=3D '" & datafine & = "'" oRs.open strSQL,oConn,3 schede =3D oRs.RecordCount Do until oRs.EOF sch_sin =3D cint(sch_sin) + cint(oRs("SCHE_SINGOLA").Value) oRs.movenext Loop Then inside my asp page in the body i write the result. and this works <%=20 Response.write schede %> Then i want to get the SUM of the values inserted in the SCHE_SINGOLA = column (defined as text) <% Response.Write sch_sin %> But here i get a type mismacth error.. What should i do? Thanks Shavonne Wijesinghe www.studioform.it =20 ------=_NextPart_000_0054_01C76AE0.EDBB1D70 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
Hello
 
I have a postgresql table = and i do a=20 select via ASP
 
strSQL =3D "SELECT = * FROM " &=20 MioTabella & " WHERE TRIM(date_inserted) >=3D '" & datainizio = & "'=20 AND TRIM(date_inserted) <=3D '" & datafine &=20 "'"
 
oRs.open=20 strSQL,oConn,3
schede =3D oRs.RecordCount
 
Do = until=20 oRs.EOF
 sch_sin =3D cint(sch_sin) +=20 cint(oRs("SCHE_SINGOLA").Value)
oRs.movenext
Loop
 
Then inside my asp page in = the body i=20 write the result. and this works
 
<% =
 Response.write=20 schede
%>
 
Then i want to get the SUM = of the=20 values inserted in the SCHE_SINGOLA column (defined as = text)
 
<%
 Response.Write=20 sch_sin
%>
 
But here i get = a type=20 mismacth error..
What should i=20 do?
 = ;
Thanks
 
Shavonne Wijesinghe
www.studioform.it
 
------=_NextPart_000_0054_01C76AE0.EDBB1D70-- From martin@bugs.unl.edu.ar Tue Mar 20 11:55:44 2007 Received: from localhost (maia-4.hub.org [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id 26B829FB2E2 for ; Tue, 20 Mar 2007 08:55:44 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-new, port 10024) with ESMTP id 17418-09 for ; Tue, 20 Mar 2007 08:55:40 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from bugs.unl.edu.ar (bugs.unl.edu.ar [168.96.132.208]) by postgresql.org (Postfix) with ESMTP id 859709FB2C2 for ; Tue, 20 Mar 2007 08:55:40 -0300 (ADT) Received: from localhost (localhost [127.0.0.1]) by bugs.unl.edu.ar (Postfix) with ESMTP id 5B4576F922; Tue, 20 Mar 2007 08:55:38 -0300 (ART) Received: from bugs.unl.edu.ar ([127.0.0.1]) by localhost (bugs.unl.edu.ar [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id uuEw4p5dBxcK; Tue, 20 Mar 2007 08:55:37 -0300 (ART) Received: by bugs.unl.edu.ar (Postfix, from userid 1000) id 282F86F91F; Tue, 20 Mar 2007 08:55:37 -0300 (ART) Received: from localhost (localhost [127.0.0.1]) by bugs.unl.edu.ar (Postfix) with ESMTP id 0B4E6FF3A; Tue, 20 Mar 2007 08:55:36 -0300 (ART) Date: Tue, 20 Mar 2007 08:55:36 -0300 (ART) From: Martin Marques To: Shavonne Marietta Wijesinghe cc: pgsql-sql@postgresql.org Subject: Re: Select and Count In-Reply-To: <005701c76ad8$8c4c7690$1102a8c0@dream> Message-ID: References: <005701c76ad8$8c4c7690$1102a8c0@dream> MIME-Version: 1.0 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.021 tagged_above=0 required=5 tests=AWL, BAYES_50 X-Spam-Level: Content-Type: TEXT/PLAIN; charset=iso-8859-1; format=flowed Content-Transfer-Encoding: QUOTED-PRINTABLE X-Archive-Number: 200703/271 X-Sequence-Number: 27909 On Tue, 20 Mar 2007, Shavonne Marietta Wijesinghe wrote: > Hello > > I have a postgresql table and i do a select via ASP > > strSQL =3D "SELECT * FROM " & MioTabella & " WHERE TRIM(date_inserted) >= =3D '" & datainizio & "' AND TRIM(date_inserted) <=3D '" & datafine & "'" > > oRs.open strSQL,oConn,3 > schede =3D oRs.RecordCount > > Do until oRs.EOF > sch_sin =3D 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= =20 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=20 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=EDn Marqu=E9s | SELECT 'mmarques' || Centro de Telem=E1tica | '@' || 'unl.edu.ar'; Universidad Nacional | DBA, Programador, del Litoral | Administrador ---------------------------------------------------------= From Bart.Degryse@indicator.be Tue Mar 20 13:25:22 2007 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__=--