I have the below SQL statement in the beginning of my ASP page
If there are no records found the program stops and gives me an error: ADODB.Recordset error '800a0bcd'...this is because there are no records found that meet the date criteria.
My question is if there is a way around this. I have tried an 'IF' Statement, but this doesn't seem to be working for me...I am sure that I am doing something wrong.
Code:
MySQL = "SELECT * FROM ShipSummary (NOLOCK) where ShipDate = DateDiff(d, 0, GetDate()+1)"
If there are no records found the program stops and gives me an error: ADODB.Recordset error '800a0bcd'...this is because there are no records found that meet the date criteria.
My question is if there is a way around this. I have tried an 'IF' Statement, but this doesn't seem to be working for me...I am sure that I am doing something wrong.
Code:
SET MyRecordSet = SERVER.CREATEOBJECT("ADODB.RECORDSET")
MySQL = "SELECT * FROM ShipSummary (NOLOCK) where ShipDate = DateDiff(d, 0, GetDate()+1)"
MyRecordSet.OPEN MySQL, XXXXXX
MyArray = MyRecordSet.GETROWS()
MyRecordSet.CLOSE
FOR MyCursor = LBOUND(MyArray,2) TO UBOUND(MyArray,2)
IF MyArray(3,MyCursor) = Date()+1 then
body = body + "<TR><TD BGCOLOR=""" & SHADE & """><B>" & " </TD><TD BGCOLOR=""" & SHADE & """><B>" & "</TD><TD BGCOLOR=""" & SHADE & """><B>" &
" </TD><TD COLSPAN=4 BGCOLOR=""" & SHADE & """><B>"& MyArray(0,MyCursor) & "</TD><TD ALIGN=""CENTER"" BGCOLOR=""" & SHADE & """><B>" &
MyArray(1,MyCursor) & "</TD><TD ALIGN=""CENTER"" BGCOLOR=""" & SHADE & """><B>" & MyArray(2,MyCursor) & "</TD><TD ALIGN=""CENTER"" BGCOLOR=""" & SHADE &
"""><B>" & MyArray(3,MyCursor) & "</TD><TD ALIGN=""CENTER"" BGCOLOR=""" & SHADE & """><B>" & MyArray(4,MyCursor) & "</TD><TD BGCOLOR=""" & SHADE & """>"&
"</TD><TD ALIGN=""CENTER"" BGCOLOR=""" & SHADE & """></TD></TR>" & vbcrlf
END IF