异常错误 [英] Exception error

查看:71
本文介绍了异常错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

温馨的新年问候,他们亲爱的家人和众生旁边的一切都很幸福。现在对于这个主题,我在这个子程序中有一个错误

异常。错误是:(0x80020009)

数据库是SQL Server 2000.

******************* ***************

Sub Desplegar(Mes)

设置dConn = Server.CreateObject(" adodb.connection")

dConn.open应用程序(" StrConRuta")

设置dRs = dConn.Execute(" select * from solicitud_canje_gte_temp

rut = ''"& session(" Rut")&';''ORDER BY month(fecha)")

do dRs.eof

回应.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 =''txt表''>< 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>")

回复.Write("< td class =''txtTable''>< di v

align =''center''>< strong> Objetivo< / strong>< / div>< / td>")

回应。写(<< / tr>")

VFech = dRs(" fecha")

*一直到月(dRs(Fecha)) <>月(VFech)(错误行)(0x80020009)

Response.Write("< tr> ")

Response.Write("< td width ='''10%''class =''txtTable''>"& dRs(" fecha")& "< / td>")

Response.Write("< td width =''10%''align =''center''class =''txtTable''< blockquote class =post_quotes>"& 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>")

总计= cint(总计+ cint(dRs(puntos)))

dRs.MoveNext

循环

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 ='''''>< / font>

< / div>< / td>< td width ='''10%''class =''TxtTable ''>< div align =''center''>< font

size ='''''><"& formatnumber(Total,0 ,,, -2)&"< / font>< / div>< td width =''14%''

align =''right''class =''txtTable'' >< div align =''center''>< font size =''''>< / font>

< / div>< / td>< td width =''27%''class =''txtTable''>< div align =''center''>< font

size ='''''>< / font>< / div>< / td>< / tr>")

dRs.MoveNext

TotalG = cint(TotalG + cint(总计))

循环

结束子


****** ****************************

这个子例程以每月订购的iforme加载一个pagina。请帮助

me

谢谢

-

Marco Antonio Artus S.

Lakromsoft INC。

09-9594663

解决方案

Lakrom写道:

先生们温暖新年的问候,他们亲爱的家人和众生一切都很开心。现在对于这个主题,我在这个子程序中有一个异常的错误。错误是:(0x80020009)




您需要在尝试

读取任何值之前验证您的查询是否返回了任何记录记录集中的字段。你这样做是使用

EOF属性。


''打开记录集,然后


如果不是dRS .EOF然后

做到月(dRs(Fecha))<>月(VFech)

...

否则

Response.Write没有记录被退回

结束如果


您可以通过打印来调试您的查询。将sql语句分配给

变量而不是直接执行它:

dim sSQL

sSQL =" select * from solicitud_canje_gte_temp其中 &安培; _

" rut =''"& session(" Rut")&"''ORDER BY month(fecha)"。


Response.Write sSQL


设置dRs = dConn.Execute(sSQL ,, 1)

....

当你在页面上运行
时,查看写入浏览器窗口的语句,并验证它是否是一个有效的sql语句,它看起来像你想要的那样b $ b看看。


Bob Barrows

..

-

Microsoft MVP - ASP / ASP.NET

请回复新闻组。我的From

标题中列出的电子邮件帐户是我的垃圾邮件陷阱,因此我不经常检查它。通过发布到新闻组,您将获得更快的回复。


谢谢,但我已经证明注册表没有来自vacio,我

已经使用Response.Write(dRs(fecha))和Response.End()asi完成了它我认为异常必须是另一方面。

" Lakrom" < LA **** @ terra.cl> escribióenel mensaje

news:P6 ***************** @ jagger.tie.cl ...

先生们热烈的新年问候,他们亲爱的家人和众生旁边的一切都很幸福。现在对于这个主题,我在这个子程序中有一个异常错误。错误是:(0x80020009)
数据库是SQL Server 2000.
*************************** ***** /
Sub Desplegar(Mes)
设置dConn = Server.CreateObject(" adodb.connection")
dConn.open应用程序(" StrConRuta") rut =''"& session(" Rut")&"''ORDER BY month(fecha)")
直到dRs.eof
Response.Write("< tr align =''center''bgcolor =''#CCCCCC''>")
Response.Write( "< td colspan ='''6''class =''txtTable Estilo6''> Canjes Mes
& nombremes(月(dRs(" fecha)))&"< ; / td>")
Response.Write("< / tr>")
Response.Write("< tr align =''center''>")
Response.Write("< td width =''13%''class =''txtTable''>< div
align =''center''& gt;< 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)
*直到月份(dRs(Fecha) ))<>月(VFech)(错误行)(0x80020009)
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")&安培;"& lt; / td>")


Response.Write("< td width =''30%''
class =''txtTable''>"& dRs(objetivo)&"< / td>")
Response.Write("< / tr>")
总计= cint(总计+ cint(dRs) (puntos)))
dRs.MoveNext
循环
Response.Write("< tr align =''center''class =''txt''>< ; td height =''22''



colspan =''3''align =''center''class =''txtTable''>< div
align =''center''>< strong>小计< / strong>< font size =''''>< / font>
< / div>< / td>< td width =''10%''class =''TxtTable''>< div align =''center''>< font
size =''''''> <& formatnumber(Total,0 ,,, - 2)&"< / font>< / div>< td width ='''14%''
align =''对''class =''txtTable''> ;< div align =''center''>< font size ='''''>< / font>
< / div>< / td>< td width =' '27%''class =''txtTable''>< div align =''center''>< font
size ='''''>< / font>< / div>< / td>< / tr>")
dRs.MoveNext
TotalG = cint(TotalG + cint(总计))
循环
End Sub

**********************************这个子例程加载到pagina a iforme每月订购。请帮助

谢谢
-
Marco Antonio Artus S.
Lakromsoft INC。
09-9594663



请回复并附上您所收到的消息的报价

回复。你不必引用整个消息,事实上,最好是将b
修剪不相关的信息部分,我将在下面做。


Lakrom写道:

谢谢,但我已经证明注册表没有来了
vacio,我用Response.Write(dRs(fecha))完成了它并且
Response.End()asi,我认为异常必须是另一方。


设置dRs = dConn.Execute(" select * from solicitud_canje_gte_temp,其中
rut =''"& session(" Rut")&"''ORDER BY month(fecha)")<直到dRs.eof


我确实错过了这一行。好的,你的记录集包含记录。

*一直到月(dRs(Fecha))<>月(VFech)(错误行)
(0x80020009)




如果你只是做什么会发生什么


Response.Write month(VFech)

?您确定VFech包含有效日期吗?如果您收到错误,请尝试使用CDate明确地将其转换为日期:


Response.Write month(CDate(VFech))


鲍勃巴罗斯


-

微软MVP - ASP / ASP.NET

请回复新闻组。我的From

标题中列出的电子邮件帐户是我的垃圾邮件陷阱,因此我不经常检查它。通过发布到新闻组,您将获得更快的回复。


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("<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")))
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
--
Marco Antonio Artus S.
Lakromsoft INC.
09-9594663

解决方案

Lakrom wrote:

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
..
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don''t check it very often. You will get a
quicker response by posting to the newsgroup.


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.
"Lakrom" <la****@terra.cl> escribió en el mensaje
news:P6*****************@jagger.tie.cl...

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("<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")))
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
--
Marco Antonio Artus S.
Lakromsoft INC.
09-9594663



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.

Lakrom wrote:

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.


Set dRs=dConn.Execute("select * from solicitud_canje_gte_temp where
rut=''"&session("Rut")&"'' ORDER BY month(fecha)")
do until dRs.eof
I did miss this line. OK, your recordset contains records.
* Do until month(dRs("Fecha"))<>month(VFech) (Line of error)
(0x80020009)



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

--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don''t check it very often. You will get a
quicker response by posting to the newsgroup.


这篇关于异常错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆