Results 1 to 12 of 12
  1. #1
    Join Date
    Dec 2003
    Posts
    148

    Unanswered: Very Strange Error

    Hi everyone. I have a page that paging through a recordset - works w/o issue. The problem is if I try to page fwd, I get an error on a certain line. The error is:

    Error Type:
    (0x80020009)
    Exception occurred.

    This is the line it occurs on:
    Response.Write "<td class=smShadeMed>" & formatdatetime(objRS("dSubmit"),2) & "</td>"

    If I comment out the line, it works with no issue. If I remove the formatdatetime function, it does not work - so it isn't that. Also, this only occurs during paging i.e., if I don't page and dump the entire recordset out - no problems...

    This is what the code around it looks like:
    Code:
                    For intRec=1 To ObjRS.PageSize 
                        If Not ObjRS.EOF Then 
                            if iLineNum mod 2 = 0 then 
                            Response.Write "<tr>" 
                             
                                Response.Write "<td class=smShadeMed>" & objRS("dSubmit") & "</td>" 
                                Response.Write "<td class=smShadeMed>" & ObjRS("cAccount") & "</td>" 
                                Response.Write "<td class=smShadeMed>" & ObjRS("cMobile") & "</td>" 
                                Response.Write "<td class=smShadeMed>" & cPricePlan & "</td>" 
                                Response.Write "<td class=smShadeMed>" & cPromoCode & "</td>" 
                                Response.Write "<td class=smShadeMed>" & cPricePlan & "</td>" 
                                Response.Write "<td class=smShadeMed>" & cDiscountCode & "</td>" 
                                Response.Write "<td class=smShadeMed>" & cFeatureCode & "</td>" 
                                Response.Write "<td class=smShadeMed>" & objRS("cMarket") & "</td>" 
                                Response.Write "<td class=smShadeMed>" & objRS("cChannel") & "</td>" 
                                Response.Write "<td class=smShadeMed>" & objRS("iReason") & "</td>" 
                                Response.Write "<td class=smShadeMed>" & objRS("cApprName") & "</td>" 
                                 
                            Response.Write "<tr>" 
                            else 
                                Response.Write "<td class=smShadeLite>" & objRS("dSubmit") &"</td>" 
                                Response.Write "<td class=smShadeLite>" & ObjRS("cAccount") & "</td>" 
                                Response.Write "<td class=smShadeLite>" & ObjRS("cMobile") & "</td>" 
                                Response.Write "<td class=smShadeLite>" & cPricePlan & "</td>" 
                                Response.Write "<td class=smShadeLite>" & cPromoCode & "</td>" 
                                Response.Write "<td class=smShadeLite>" & cPricePlan & "</td>" 
                                Response.Write "<td class=smShadeLite>" & cDiscountCode & "</td>" 
                                Response.Write "<td class=smShadeLite>" & cFeatureCode & "</td>" 
                                Response.Write "<td class=smShadeLite>" & objRS("cMarket") & "</td>" 
                                Response.Write "<td class=smShadeLite>" & objRS("cChannel") & "</td>" 
                                Response.Write "<td class=smShadeLite>" & objRS("iReason") & "</td>" 
                                Response.Write "<td class=smShadeLite>" & objRS("cApprName") & "</td>" 
                            End If 
                            ObjRS.MoveNext 
                            iLineNum = iLineNum + 1 
                        End If 
                    Next 
                    Response.Write "</tbody></table><p>"

  2. #2
    Join Date
    Nov 2003
    Location
    Christchurch, New Zealand
    Posts
    1,618
    dunno what is causing your problem bust save yourself some heartache and try changing you code to this for starters
    Code:
    For intRec=1 To ObjRS.PageSize 
       If Not ObjRS.EOF Then 
          if iLineNum mod 2 = 0 then 
            myClass = "smShadeMed"
          else
            myClass = "smShadeLite"
         end if
         Response.Write "<tr>" 
         Response.Write "<td class=" & myClass & ">" & objRS("dSubmit") & "</td>" 
         .....
         Response.Write "<tr>" 
         ObjRS.MoveNext 
         iLineNum = iLineNum + 1 
      End If 
    Next 
    Response.Write "</tbody></table><p>"

  3. #3
    Join Date
    Jul 2003
    Location
    SoCal
    Posts
    721
    Sounds like dSubmit might be blank or NULL on one or more columns in the recordset.
    That which does not kill me postpones the inevitable.

  4. #4
    Join Date
    Nov 2003
    Location
    Christchurch, New Zealand
    Posts
    1,618
    If it was null then when he removed the formatdatetime function call it should have started working properly... in theory...

  5. #5
    Join Date
    Jul 2003
    Location
    SoCal
    Posts
    721
    Not necessarily. I recently had an issue where a Response.Write refused to work when I included a value from a recordset which had a NULL in it. I wasn't doing any special formatting of the value. The entire line refused to be written (which included some table structure). Ex:

    Response.Write "<td>" & objrs("Field") & "</td>"

    When I checked the source, no line was there. When I did a Response.Write for each segment:

    Response.Write "<td>"
    Response.write objrs("Field")
    Response.Write "</td>

    It would work (with nothing between the tags for the row with a NULL field). I ended up having to do a check before I wrote the value:

    Code:
    Dim FieldValue
    If objrs("Field") = "" Then
      FieldValue = ""
    Else
      FieldValue = objrs("FieldValue")
    End If
    
    Response.Write "<td>" & FieldValue & "</td>"
    Dunno.. strange.. Just something to check maybe..
    That which does not kill me postpones the inevitable.

  6. #6
    Join Date
    Nov 2003
    Location
    Christchurch, New Zealand
    Posts
    1,618
    Yeah, I have had that before but normally with a + instead of an &....

    But as you said it wouldn't write the line but it wouldn't display an error either....

  7. #7
    Join Date
    Jul 2003
    Location
    SoCal
    Posts
    721
    Quote Originally Posted by rokslide
    But as you said it wouldn't write the line but it wouldn't display an error either....
    Exactly...
    That which does not kill me postpones the inevitable.

  8. #8
    Join Date
    Nov 2003
    Location
    Christchurch, New Zealand
    Posts
    1,618
    The reason I suspect you get that behaviour with a null and a + is because it doesn't know what you are adding to what. null is undefined and if you add something that is undefined to something else you get something that is still undefined....

    The interesting thing about the error that guy is experiencing is the fact that it only happens with the paging that he has set up. Personally I haven't used the PageSize property very much so I don't know the ins and outs of it.... it wouldn't have something to do withthe number of records returned being less then the pagesize value would it?
    Last edited by rokslide; 07-26-04 at 03:19.

  9. #9
    Join Date
    Jul 2003
    Location
    SoCal
    Posts
    721
    Quote Originally Posted by rokslide
    The reason I suspect you get that behaviour with a null and a + is because it doesn't know what you are adding to what. null is undefined and if you add something that is undefined to something else you get something that is still undefined....
    Right, but if you're adding an unknown value to a string:

    Response.Write "some string text" & objrs("myVariable")

    It should automatically assume that "myVariable" is also a string. Therefore, if myVariable is NULL, it's implicit converstion to a string is an empty value.

    I understand why it happens, but I don't like it. Since you can compare a null to an empty and the implicit converstion is performed:

    If objrs("myVariable") = "" Then...

    but you can't append a null to a string (as above) through implicit converstion, IMO it seems inconsistant.
    That which does not kill me postpones the inevitable.

  10. #10
    Join Date
    Jul 2003
    Location
    SoCal
    Posts
    721
    Quote Originally Posted by rokslide
    The interesting thing about the error that guy is experiencing is the fact that it only happens with the paging that he has set up. Personally I haven't used the PageSize property very much so I don't know the ins and outs of it.... it wouldn't have something to do withthe number of records returned being less then the pagesize value would it?
    Forgot to mention that I've never had PageSize or CurrentPage ever work for me. Instead, I did it more efficiently by apply paging at the DB level through stored procedures.
    That which does not kill me postpones the inevitable.

  11. #11
    Join Date
    Nov 2003
    Location
    Christchurch, New Zealand
    Posts
    1,618
    Yeah, I always apply paging at the db level as well....

    With the whole null thing null="" should return false to be honest... it seems to work in vbscript but that is only because it is a scripting language and it's constraints are not quite so tight....

    Personally I'd always use isNull because you can be sure of the results at all times...

  12. #12
    Join Date
    May 2004
    Posts
    21
    I had the same problem and I have found it on Microsoft knowledge base.
    I not feel like searching it again, but I will tell you what I did to avoid this 'funny' message.
    on folder wich contains your db click properties, then choose Security and add user IUSR_<computername> and give him full control.
    you can do this on your db as well.
    this solves my problem and Iam happy , but I have NTFS file system and better support for Security options... Iam not sure about FAT32 FS users

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •