From: | "Bart Degryse" <Bart(dot)Degryse(at)indicator(dot)be> |
---|---|
To: | <pgsql-sql(at)postgresql(dot)org> |
Cc: | "Shavonne Marietta Wijesinghe" <shavonne(dot)marietta(at)studioform(dot)it> |
Subject: | Re: Select and Count |
Date: | 2007-03-20 13:25:01 |
Message-ID: | 45FFEEBD.A3DD.0030.0@indicator.be |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
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(at)bugs(dot)unl(dot)edu(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | Karthikeyan Sundaram | 2007-03-20 19:34:09 | ERROR: invalid byte sequence for encoding "UTF8": 0x92 |
Previous Message | Alvaro Herrera | 2007-03-20 12:46:37 | Re: unsubscribe |