ASP error '80020009'

Hello,

I have a code that used to work! now for some reason not any more!
all I get after clicking update is

error '80020009'

/academics/timetable_admin/tt_edit_2.asp, line 73

and it dose the update !!!
but it stops and will not continue the rest of the code (showing the table with updated data)

any clue ?
55 '============================================================
56 ' Fix and update the timetable Day based on the Day type
57 sql_str = "SELECT timetable_description.start_date, timetable_description.end_date, timetable_descrip
tion.rotation, timetable_description.start_day FROM timetable_description WHERE timetable_description.id="&tt
_id
58 Set RY = Server.CreateObject("ADODB.Recordset")
59 RY.Open sql_str, objConn, adOpenKeyset, adLockOptimistic
60
61 curDate = CDATE(RY("start_date"))
62 endDAte = CDATE(RY("end_date"))
63 curDay = RY("start_day")
64 rotation = RY("rotation")
65
66 Set RX = Server.CreateObject("ADODB.Recordset")
67 DO While curDate <= endDAte
68
69 sql_str = "SELECT timetable_days.day, timetable_days.type FROM timetable_days WHERE timetable_day
s.date = #"&curDate&"# AND timetable_days.tt_id="&tt_id
70
71 RX.Open sql_str, objConn, adOpenDynamic, adLockOptimistic
72
73 IF RX("type") = 10 THEN
74 RX("day") = curDay
75
76 curDay = CurDay + 1
77 IF curDay > rotation THEN
78 curDay = 1
79 END IF
80
81 ELSE
82 RX("day") = 0
83 END IF
84
85 RX.Update
86 RX.Close
87
88 curDate = dateadd("d",1,CDATE(curDate))
89
90 LOOP
91
92 '==============================================================

Open in new window

Data-BaseAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

thenelsonCommented:
Did the error message provide a description? When you click on debug, which line is highlighted?

0
Shaun KlineLead Software EngineerCommented:
Check out this page: http://classicasp.aspfaq.com/general/why-do-i-get-80020009-errors.html.
Based on the line number provided in the error message, I would guess that your query brought back no data. It is good practice to always verify that data has been returned. See attached code.

If Not RX.BOF And Not RX.EOF Then
  IF RX("type") = 10 THEN
    RX("day") = curDay
    curDay = CurDay + 1
    IF curDay > rotation THEN
      curDay = 1
    END IF
  ELSE
    RX("day") = 0
  END IF
  RX.Update
END IF

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Data-BaseAuthor Commented:
Hello Thank you

thenelson , That is the only Error message I got!


Shaun_Kline, your code worked, how I did not notice that!
now can I use as the example below? I usually use it to check.

change "If Not RX.BOF And Not RX.EOF Then" with "If RX.RecordCount > 0 Then" ?

and witch one is better?
If RX.RecordCount > 0 Then
  IF RX("type") = 10 THEN
    RX("day") = curDay
    curDay = CurDay + 1
    IF curDay > rotation THEN
      curDay = 1
    END IF
  ELSE
    RX("day") = 0
  END IF
  RX.Update
END IF

Open in new window

0
Shaun KlineLead Software EngineerCommented:
The one issue that can occur, depending on the type of data source you are using, is that RecordCount is not always populated. (I forget what version of ADO and what data source it was that I ran into this issue.) Checking for BOF and EOF (and truthfully, I only checked for EOF) seems to be consistent.
0
Data-BaseAuthor Commented:
Thanks allot :-)
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP

From novice to tech pro — start learning today.