?您确定VFech包含有效日期吗?如果您收到错误,请尝试使用CDate明确地将其转换为日期: Response.Write month(CDate(VFech)) 鲍勃巴罗斯 - 微软MVP - ASP / ASP.NET 请回复新闻组。我的From 标题中列出的电子邮件帐户是我的垃圾邮件陷阱,因此我不经常检查它。通过发布到新闻组,您将获得更快的回复。 Gentlemen a warm greeting of New Year, that everything is happy next totheir dear family and beings. Now to the subject, I have an error ofexception 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 whererut=''"&session("Rut")&"'' ORDER BY month(fecha)")do until dRs.eofResponse.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'' ><divalign=''center''><strong>Fecha Canje </strong></div></td>")Response.Write("<td width=''7%'' class=''txtTable''><divalign=''center''><strong>Código</strong></div></td>")Response.Write("<td width=''29%'' class=''txtTable''><divalign=''center''><strong>Producto</strong></div></td>")Response.Write("<td class=''txtTable''><divalign=''center''><strong>Puntos</strong></div></td>")Response.Write("<td class=''txtTable'' ><divalign=''center''><strong>Cantidad</strong></div></td>")Response.Write("<td class=''txtTable'' ><divalign=''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.MoveNextLoopResponse.Write("<tr align=''center'' class=''txt''><td height=''22'' colspan=''3''align=''center'' class=''txtTable''><divalign=''center''><strong>Sub-Total</strong><font size=''2''></font></div></td><td width=''10%'' class=''TxtTable''><div align=''center''><fontsize=''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''><fontsize=''2''></font></div></td></tr>")dRs.MoveNextTotalG=cint(TotalG+cint(Total))loopEnd Sub**********************************This sub routine loads in a pagina a iforme ordered per month. Please helpmeThanks--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 attemptto read the values of any fields in your recordset. You do this using theEOF property.''open the recordset, thenif not dRS.EOF thenDo until month(dRs("Fecha"))<>month(VFech)...elseResponse.Write "No records were returnedend ifYou can debug your query by printing it out. Assign the sql statement to avariable instead of executing it directly:dim sSQLsSQL = "select * from solicitud_canje_gte_temp where " & _"rut=''"&session("Rut")&"'' ORDER BY month(fecha)".Response.Write sSQLSet dRs=dConn.Execute(sSQL,,1)....Look at the statement that gets written to the browser window when you runthe page and verify that it is a valid sql statement that looks the way youexpect it to look.Bob Barrows..--Microsoft MVP -- ASP/ASP.NETPlease reply to the newsgroup. The email account listed in my Fromheader is my spam trap, so I don''t check it very often. You will get aquicker response by posting to the newsgroup.Thanks but already I have proven that the registry does not come vacio, Ihave done it with Response.Write(dRs("fecha")) and Response.End() asi that Ibelieve that the exception must be of another side."Lakrom" <la****@terra.cl> escribió en el mensajenews: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ó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-9594663Please reply to and include a quote from the message to which you arereplying. You do not have to quote the whole message, in fact, it is best totrim 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.eofI 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 doResponse.Write month(VFech)? Are you certain VFech contains a valid date? If you get an error, tryexplicitly converting it to a date using CDate:Response.Write month(CDate(VFech))Bob Barrows--Microsoft MVP -- ASP/ASP.NETPlease reply to the newsgroup. The email account listed in my Fromheader is my spam trap, so I don''t check it very often. You will get aquicker response by posting to the newsgroup. 这篇关于异常错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云! 08-21 20:42