Exception error

L

Lakrom

Gentlemen a warm greeting of New Year, that everything is happy next to
their dear family and beings. Now to the subject, I have an error of
exception in this subroutine. The error is:(0x80020009)
A data base is SQL Server 2000.
**********************************
Sub Desplegar (Mes)
Set dConn=Server.CreateObject("adodb.connection")
dConn.open application("StrConRuta")
Set dRs=dConn.Execute("select * from solicitud_canje_gte_temp where
rut='"&session("Rut")&"' ORDER BY month(fecha)")
do until dRs.eof
Response.Write("<tr align='center' bgcolor='#CCCCCC' >")
Response.Write("<td colspan='6' class='txtTable Estilo6' >Canjes Mes
"&nombremes(month(dRs("fecha")))&"</td>")
Response.Write("</tr>")
Response.Write("<tr align='center'>")
Response.Write("<td width='13%' class='txtTable' ><div
align='center'><strong>Fecha Canje </strong></div></td>")
Response.Write("<td width='7%' class='txtTable'><div
align='center'><strong>C&oacute;digo</strong></div></td>")
Response.Write("<td width='29%' class='txtTable'><div
align='center'><strong>Producto</strong></div></td>")
Response.Write("<td class='txtTable'><div
align='center'><strong>Puntos</strong></div></td>")
Response.Write("<td class='txtTable' ><div
align='center'><strong>Cantidad</strong></div></td>")
Response.Write("<td class='txtTable' ><div
align='center'><strong>Objetivo</strong></div></td>")
Response.Write("</tr>")
VFech=dRs("fecha")
* Do until month(dRs("Fecha"))<>month(VFech) (Line of error) (0x80020009)
Response.Write("<tr> ")
Response.Write( said:
"&dRs("cod_producto")&"</td>")
Response.Write("<td width='30%' align='center' class='txtTable'
"&dRs("descripcion")&"</td>")
Response.Write("<td width='10%' align='center' class='txtTable'
"&dRs("puntos")&"</td>")
Response.Write("<td width='10%' align='center' class='txtTable'
"&dRs("cantidad")&"</td>")
Response.Write("<td width='30%'
class='txtTable'>"&dRs("objetivo")&"</td>")
Response.Write("</tr>")
Total=cint(Total+cint(dRs("puntos")))
dRs.MoveNext
Loop
Response.Write("<tr align='center' class='txt'><td height='22' colspan='3'
align='center' class='txtTable'><div
align='center'><strong>Sub-Total</strong><font size='2'></font>
</div></td><td width='10%' class='TxtTable'><div align='center'><font
size='2'><"&formatnumber(Total,0,,,-2)&"</font></div><td width='14%'
align='right' class='txtTable'><div align='center'><font size='2'></font>
</div></td><td width='27%' class='txtTable'><div align='center'><font
size='2'></font></div></td></tr>")
dRs.MoveNext
TotalG=cint(TotalG+cint(Total))
loop
End Sub

**********************************
This sub routine loads in a pagina a iforme ordered per month. Please help
me
Thanks
 
B

Bob Barrows [MVP]

Lakrom said:
Gentlemen a warm greeting of New Year, that everything is happy next
to their dear family and beings. Now to the subject, I have an error
of exception in this subroutine. The error is:(0x80020009)

You need to verify that your query returned any records before you attempt
to read the values of any fields in your recordset. You do this using the
EOF property.

'open the recordset, then

if not dRS.EOF then
Do until month(dRs("Fecha"))<>month(VFech)
...
else
Response.Write "No records were returned
end if

You can debug your query by printing it out. Assign the sql statement to a
variable instead of executing it directly:

dim sSQL
sSQL = "select * from solicitud_canje_gte_temp where " & _
"rut='"&session("Rut")&"' ORDER BY month(fecha)".

Response.Write sSQL

Set dRs=dConn.Execute(sSQL,,1)
....


Look at the statement that gets written to the browser window when you run
the page and verify that it is a valid sql statement that looks the way you
expect it to look.

Bob Barrows
..
 
L

Lakrom

Thanks but already I have proven that the registry does not come vacio, I
have done it with Response.Write(dRs("fecha")) and Response.End() asi that I
believe that the exception must be of another side.
 
B

Bob Barrows [MVP]

Please reply to and include a quote from the message to which you are
replying. You do not have to quote the whole message, in fact, it is best to
trim the parts of the message which are not relevant, as I will do below.
Thanks but already I have proven that the registry does not come
vacio, I have done it with Response.Write(dRs("fecha")) and
Response.End() asi that I believe that the exception must be of
another side.

I did miss this line. OK, your recordset contains records.

What happens if you simply do

Response.Write month(VFech)

? Are you certain VFech contains a valid date? If you get an error, try
explicitly converting it to a date using CDate:

Response.Write month(CDate(VFech))

Bob Barrows
 
L

Lakrom

Yes this line Response.Write month(VFech) contains a valid date and prove to
with CDate function and is the same error.
 
L

Lakrom

Yes this line Response.Write month(VFech) contains a valid date and prove to
with CDate function and is the same error.
 
L

Lakrom

Yes this line Response.Write month(VFech) contains a valid date and prove to
with CDate function and is the same error.
 
B

Bob Barrows [MVP]

What about month(dRs("Fecha"))?
Are there any records where dRs("Fecha") is Null or empty?

Bob Barrows

Response.Write
 
B

Bob Barrows [MVP]

Lakrom said:
No any one.

Show us the contents of dRs("Fecha")

You are going to need to verify where this error is occurring. The best way
to do that is create a test page with only the code needed to cause the
error. I would start with a page like this:

<%
Set dConn=Server.CreateObject("adodb.connection")
dConn.open application("StrConRuta")
dim sSQL
sSQL = "select * from solicitud_canje_gte_temp where " & _
"rut='"&session("Rut")&"' ORDER BY month(fecha)".

Response.Write sSQL

Set dRs=dConn.Execute(sSQL,,1)

if not dRs.EOF then
Response.Write dRs("Fecha")
Response.Write month(dRs("Fecha"))
end if
dRs.Close:Set dRs=Nothing
dConn.Close: Set dConn=Nothing
%>

Run this page and let us know if an error occurs. If no error occurs, then
the error is being caused by some other line in your code. Add lines from
the failing code one-at-a-time to the test page until you determine te
actual cause of the error, and let us know which one it is.

Bob Barrows
 
B

Bob Barrows [MVP]

Lakrom said:
The page...

You will be lucky if anyone looks at this. You will be better off creating a
small test page (as I described in my previous messsage) to try to
demonstrate your error rather than expecting somebody to read through all
the code in this page. Frankly, there was too much irrelevant code in your
original post.

Bob Barrows
 
I

io

G'day Lakrom,

To help you out with this it'd be advantegeous if you included the error description as well. As your .asp page falls over it should come up with err description as well as a script line number that cuased the err (this is a default behaviour for MS IIS).

BTW, in the code below it seems that the line VFech=dRs("fecha") should be inside your inner loop rather than outside

...................................
...................................
...................................
Do until VFech<>dRs("Fecha")
Response.Write("<tr> ")
Response.Write("<td width='10%' class='txtTable'>"&dRs("fecha")&"</td>")
Response.Write("<td width='10%' align='center' class='txtTable' >"&dRs("cod_producto")&"</td>")
Response.Write("<td width='30%' align='center' class='txtTable' >"&dRs("descripcion")&"</td>")
Response.Write("<td width='10%' align='center' class='txtTable' >"&dRs("puntos")&"</td>")
Response.Write("<td width='10%' align='center' class='txtTable' >"&dRs("cantidad")&"</td>")
Response.Write("<td width='30%' class='txtTable'>"&dRs("objetivo")&"</td>")
Response.Write("</tr>")
Total=cint(Total+cint(dRs("puntos")))
VFech=dRs("fecha")
dRs.MoveNext
Loop
VFech=dRs("fecha")
...................................
...................................
...................................

Cheers
 

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
473,774
Messages
2,569,596
Members
45,143
Latest member
SterlingLa
Top