IIS - error '80020009'

Asked By mah-skeet
16-Nov-09 12:30 PM
I have the following:

sqlstr = "SELECT Budgets.Cilcode, Budgets.[Cost Centre], Sum([Day]/60.0/8.0)
AS TSDays FROM (CIL.dbo.TIMEBIDTS INNER JOIN CIL.dbo.TIMEBIDUSERDEFTS ON
CIL.dbo.TIMEBIDTS.taskID = CIL.dbo.TIMEBIDUSERDEFTS.TaskID) INNER JOIN
CIL.dbo.Budgets ON CIL.dbo.TIMEBIDUSERDEFTS.BudgetID = CIL.dbo.Budgets.ID
WHERE (((TIMEBIDTS.Refdate)<'" &
MedDate(dateadd("m",1,request.form("RefDate"))) & "')) GROUP BY
Budgets.Cilcode, Budgets.[Cost Centre] HAVING (((Budgets.Cilcode)=" &
request.form("Cilcode") & ")) ORDER BY Budgets.[Cost Centre];"
rst.Open sqlstr, cnnSearch, 2,3

sqlstr2 = "SELECT CostCentre, TSDays FROM PMRResource WHERE CILCode=" &
request.form("Cilcode") & " and MonthID=" & request.form("MonthID") & " ORDER
BY CostCentre;"
rst2.Open sqlstr2, cnnSearch, 2,3

do while not rst2.eof
if rst2("CostCentre") = rst("Cost Centre") then
rst2("TSDays") = rst("TSDays")
if not rst.eof then
rst.movenext
end if
else
rst2("TSDays") = 0
end if
rst2.movenext
loop

I am getting the error on the line -  "if rst2("CostCentre") = rst("Cost
Centre") then"

I do not know why becuase it works sometimes, but not others

Thanks in advance for the help.

Mark
ASP.NET
(1)
PMRResource
(1)
MonthID
(1)
TSDays
(1)
CommandText
(1)
CostCentre
(1)
RefDate
(1)
MedDate
(1)
  Bob Barrows replied to mah-skeet
16-Nov-09 01:06 PM
I do not understand why you did not tell us the text of the error message.
Sure, we can google it and find out ourselves ... _but so cannot you!_ And of
course, the benefit to you is that you might have already found the answer
to your problem ...


Probably nothing to do with your problem, but what I can comment on is this:
Your use of dynamic sql is leaving you vulnerable to hackers using sql
injection:
http://mvp.unixwiz.net/techtips/sql-injection.html
http://www.sqlsecurity.com/DesktopDefault.aspx?tabid=23

See here for a better, more secure way to execute your queries by using
parameter markers:
http://groups-beta.google.com/group/microsoft.public.inetserver.asp.db/msg/72e36562fee7804e

Personally, I prefer using stored procedures, or saved parameter queries
as
they are known in Access:

Access:



Select statement:
http://groups-beta.google.com/group/microsoft.public.inetserver.asp.db/msg/b3d322b882a604bd

Using Command object to parameterize CommandText:
http://groups-beta.google.com/group/microsoft.public.inetserver.asp.db/msg/72e36562fee7804e


--
Microsoft MVP - ASP/ASP.NET - 2004-2007
Please reply to the newsgroup. This email account is my spam trap so I
do not check it very often. If you must reply off-line, then remove the
  Bob Barrows replied to mah-skeet
16-Nov-09 01:09 PM
Here is the first result from a google search. Does it help?
--
Microsoft MVP - ASP/ASP.NET - 2004-2007
Please reply to the newsgroup. This email account is my spam trap so I
do not check it very often. If you must reply off-line, then remove the
  Dan replied to mah-skeet
17-Nov-09 05:30 AM
Your code does not take into account what happens when rst is EOF, which is
why you get the error. You need to add another If statement in before you
compare the fields.

do while not rst2.eof
'check rst is not eof here!
if not rst.eof then
'your code from above
else
'what to do when rst is eof
end if
rst2.movenext
loop



--
Dan
  Bob Barrows replied to Bob Barrows
18-Nov-09 10:05 AM
Oops! Somehow forgot the link! Here goes:
http://classicasp.aspfaq.com/general/why-do-i-get-80020009-errors.html

--
HTH,
Bob Barrows
Create New Account
help
Doubt ASP.net vs classic ASP IIS Hi. . . I have tryed my best to understand the asp.net, but the visual of asp.net pages are the most complicated, because on asp we have total control over the layout the page, on the asp.net for example we have a lot of components, like tables wich already have paging, etc
how to tell which version of asp.net is in use? IIS server 2003. I added IIS and specifically selected asp.net. I realize this version is 1.1. However, before doing this I had already installed windows update. looking in IIS manager I see by using add / remove programs to add asp.net that the asp.net v1.1 web extension was enabled. Also in IIS manager on the asp.net tab
IIS 5 ASP.NET 1.1 / 2.0 IIS Is it possibly for asp.net 1.1 apps and asp.net 2.0 apps to run on a win2k server with iis 5.0? asp.net 2.0 is loaded and available in the dropdown on the website's property page
IIS-ASP.NET problem IIS I am hosting my own Asp.net website and its working fine and is on the internet. However my company website gives me an error saying that I cannot run two versions of asp.net it is not on the internet.Eventviewer tells me that I cannot run two versions of Asp.net, how ever I have no choice because Asp.net 1.4 is grayed out on