Again today, I came across an error caused by an invalid date value. The error reported was:
error '80020009'
Exception occurred.
/somefile.asp, line <number>
Went and googled again, this time it appeared as though the error was commonly caused by over-stepping the bounds of the resultset. For instance, pulling back 10 records by trying to read the 11th which doesn’t exist. Well that wasn’t the case for mine (once again), it was an invalid date format.
All I was doing, was displaying the date value. I wasn’t using it to do any calculations in either ASP or through SQL, so even it if was invalid, you would assume it would just ‘display it’ and be done with it.
For whatever reason, just trying to display a date of format ‘0000-01-04’ caused it to fall over. The solution of course, just correct the date value. Once again, lack of client and server side checking of user input bites you in the arse.
why does occure this problem?
To be brutally honest menka, I don’t know. I’ve mentioned before that the error reporting from ASP, has a lot to be desired. They use the same error code for many many different errors; when in fact the errors (after my investigations at least), seem wildly different.
You need to whittle down the error, narrowing the possibilities each time.
What are you doing when you get the error? Are you using a database for instance, is the error happening when accessing a resultset from a query, is it something else?
You would need to give me some insight for me to be able to help you at all.
i got the same error but its due to the null value in the parameter
Thanks,
Although my problem wasn’t an invalid date value, your explaination helped. My problem was actually caused by over-stepping the bounds of the resultset. I just hadn’t thought of that.
when i m trying to retrive more records from oracle database using asp page its showing exception error
There is no reason for ASP to generate that error, simply because you’ve selected more than one record. It is more likely that you’re accessing the records incorrectly. A simple method to make sure you don’t ever overstep the resultset is:
Dim cn, sSQL, oRS
Set cn = Server.CreateObject("ADODB.Connection")
cn.Open sDSN
sSQL = "SELECT field FROM table_name WHERE something = 1"
Set oRS = cn.execute(sSQL)
If Not oRS.EOF Then
While Not oRS.EOF
Response.Write "field=" & oRS("field")
oRS.MoveNext
WEnd
oRS.Close
End If
cn.Close
Set oRS = Nothing
Set cn = Nothing
Using the above method, you’ll never overstep the resultset. The reason this won’t happen is the
Not oRS.EOF
condition. So you will only ever go into theWhile
loop if the current read position in the recordset isn’t the last record in the set.Just googled upon this as I was getting the same error. However, I have a slightly different scenario. Essentially I load data into a Dictionary object to be displayed further along in the processing, like so:
…
oDict.Add key, rs.Fields( fieldname )
…
Set rs = Nothing
…
Response.Write oDict( key ) ‘ Error occurs here
…
The problem is I have blindly assumed that the VALUE of rs.Fields( fieldname ) will be added to the dictionary, when in fact a REFERENCE to the Field object is being added, which of course went out of scope the moment I set the parent ResultSet to Nothing.
Chris,
As with every language, you will nearly always have scoping problems at some point. The trick is knowing how your particular language scopes variables. I thought VBScript passed/assigned using a ByVal method instead of ByRef by default, I’ll have to look into that jus to clarify for myself.
Al.
I am having a similar problem and getting the error as follows:
50 FAQs This shows that faqnum.Count is returning the correct value
error ‘80020009’ Trying to read faqnum.Item(faq) where faq = 1
/spfaq.asp, line 87
The dictionary object in loaded from a database using Set rsFAQs = Server… and I have left rsFAQs open afterwards.
Any help is gratefully received.
I recently had the same problem using the Dictionary object.
You can fix this error by casting your key into String. Don’t know why, but it will fix the problem on Error ‘80020009’.
Fix this by putting (example) :
Response.Write oDict(CStr(key))
Is there any reason you can think of that the error would ONLY occur in IE6? Firefox, Safari, Mac, PC doesn’t seem to matter… but IE6 shows that error.
I’m completely stumped. Server-side errors shouldn’t matter what browser the user has.