View Single Post
  #1 (permalink)  
Old December 31st, 2008, 12:06 PM
dalezjc dalezjc is offline
Authorized User
Points: 287, Level: 5
Points: 287, Level: 5 Points: 287, Level: 5 Points: 287, Level: 5
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2006
Location: Colorado Springs, CO
Posts: 60
Thanks: 1
Thanked 0 Times in 0 Posts
Default Getting Error: Item cannot be found in the collection corresponding to the requested

I've got dozens of ASP scripts running without errors, but for some reason with this script, I'm getting the following error:


Item cannot be found in the collection corresponding to the requested name or ordinal.

Here's my code:

Code:
 
<%
Option Explicit
Dim rsqdb
Dim strConnection, conn
Dim raction_summary
set Conn=Server.CreateObject("ADODB.Connection")
set rsqdb = server.CreateObject("ADODB.Recordset")
set raction_summary =server.CreateObject("ADODB.Recordset")
Conn.open "Provider=sqloledb;Server=myserver;Initial Catalog=qdb;UID=Reports;PWD=;"
set rsqdb = conn.Execute ("use msdb select distinct j.Name as JobName, j.description as JobDescription, h.run_date as LastStatusDate,  " _
& " case h.run_status  " _
& " when 0 then 'Failed'  " _
& " when 1 then 'Successful'  " _
& " when 3 then 'Cancelled'  " _
& " when 4 then 'In Progress'  " _
& " end as JobStatus " _
& " from sysJobHistory h, sysJobs j " _
& " where j.job_id = h.job_id and h.run_date =  " _
& " (select max(hi.run_date) from sysJobHistory hi where h.job_id = hi.job_id) " _
& " order by JobStatus ")
%>
         <%response.write rsqdb("name")%>
<%do while not rsqdb.EOF%></do>
<%rsqdb.MoveNext%>
<%loop%>
 
<%
set rsqdb = nothing
set conn = nothing
%>
Sysjobs have name and description fields so I'm not sure why I'm getting this.

Thanks,
Dale
Reply With Quote