If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ASP > Very Strange Error

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 07-23-04, 11:28
RhythmAddict RhythmAddict is offline
Registered User
 
Join Date: Dec 2003
Posts: 148
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>"
Reply With Quote
  #2 (permalink)  
Old 07-23-04, 21:09
rokslide rokslide is offline
Registered User
 
Join Date: Nov 2003
Location: Christchurch, New Zealand
Posts: 1,617
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>"
Reply With Quote
  #3 (permalink)  
Old 07-24-04, 00:49
Seppuku Seppuku is offline
Useless...
 
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.
Reply With Quote
  #4 (permalink)  
Old 07-25-04, 19:12
rokslide rokslide is offline
Registered User
 
Join Date: Nov 2003
Location: Christchurch, New Zealand
Posts: 1,617
If it was null then when he removed the formatdatetime function call it should have started working properly... in theory...
Reply With Quote
  #5 (permalink)  
Old 07-25-04, 20:47
Seppuku Seppuku is offline
Useless...
 
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.
Reply With Quote
  #6 (permalink)  
Old 07-25-04, 20:51
rokslide rokslide is offline
Registered User
 
Join Date: Nov 2003
Location: Christchurch, New Zealand
Posts: 1,617
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....
Reply With Quote
  #7 (permalink)  
Old 07-26-04, 02:08
Seppuku Seppuku is offline
Useless...
 
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.
Reply With Quote
  #8 (permalink)  
Old 07-26-04, 02:11
rokslide rokslide is offline
Registered User
 
Join Date: Nov 2003
Location: Christchurch, New Zealand
Posts: 1,617
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 02:19.
Reply With Quote
  #9 (permalink)  
Old 07-26-04, 13:28
Seppuku Seppuku is offline
Useless...
 
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.
Reply With Quote
  #10 (permalink)  
Old 07-26-04, 13:30
Seppuku Seppuku is offline
Useless...
 
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.
Reply With Quote
  #11 (permalink)  
Old 07-26-04, 18:56
rokslide rokslide is offline
Registered User
 
Join Date: Nov 2003
Location: Christchurch, New Zealand
Posts: 1,617
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...
Reply With Quote
  #12 (permalink)  
Old 10-04-04, 20:57
kasic kasic is offline
Registered User
 
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
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On