date comparation

L

Lakrom

hello to all, i have this sql sentence Set xRs=pCon.Execute("SELECT
sum(monto_abono) AS TpuntosM FROM con_vtas WHERE RUTGTE='"&session("rut")&"'
and month("fecha")='#month("date")#'")
but this (month("fecha")='#month("date")#'") is correct?
the browser send me error "Error de compilación de Microsoft VBScript
(0x800A03EE)
Se esperaba ')'"
thank
 
G

Gérard Leclercq

In which field do you keep the month, lets say MyMonth then

MyMonth is a Integer

Set xRs=pCon.Execute("SELECT sum(monto_abono) AS TpuntosM FROM con_vtas
WHERE RUTGTE='" & session("rut") & "' AND MyMonth = " & month("date"))
 
J

John Blessing

Lakrom said:
hello to all, i have this sql sentence Set xRs=pCon.Execute("SELECT
sum(monto_abono) AS TpuntosM FROM con_vtas WHERE
RUTGTE='"&session("rut")&"'
and month("fecha")='#month("date")#'")
but this (month("fecha")='#month("date")#'") is correct?
the browser send me error "Error de compilación de Microsoft VBScript
(0x800A03EE)
Se esperaba ')'"
thank



Assign your sql query to a variable then

Set xRs=pCon.Execute(strsql)

I expect the compilation error will occur when your try to assign the
variable, because I am not sure if you have the right number of " marks,
hard to tell from looking.

Once you have that working, if you still get the error (and I think you will
because I don't know what month("date") is supposed to do), you can at least
do a response.write of the var so that you know what you are trying to
execute. You can then paste the output into MS Access (if you have it) and
run the query there, which will give you much more informative error
messages.

--
John Blessing

http://www.LbeHelpdesk.com - Help Desk software priced to suit all
businesses
http://www.room-booking-software.com - Schedule rooms & equipment bookings
for your meeting/class over the web.
http://www.lbetoolbox.com - Remove Duplicates from MS Outlook
 
A

Aaron [SQL Server MVP]

Do you mean me, or the person who faked a couple of posts filled with
garbage?

I see two posts from John Blessing, and two posts from Gérard Leclercq. One
from each is legitmate, and one from each is not (originating from the same
IP: 210.178.1.125 / news1.kornet.net). The latter are gibberish and I'm not
sure of their purpose...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,431
Messages
2,571,677
Members
48,796
Latest member
Greg L.

Latest Threads

Top