Lukke Recordset
Til tider kan jeg ikke lukke mine recordset og det har altid undret mig, specielt når mange understregr at det er vigtig at gøre det..Fx i dette tilfældet:
Dim LinkCount
LinkCount=0
SQL = "SELECT * FROM link order by created DESC,ID DESC"
SET RS=Conn.Execute(SQL)
'################
' Link LOOP
'################
If RS.BOF Or RS.EOF Then
Response.Write "<tr><td> </td></tr>"
Else
Do Until RS.EOF
If LinkCount="0" Then
Response.Write "<tr>"
End If
LinkCount = LinkCount + 1
Response.Write "<td nowrap>" & vbCrLf &_
"<a href=""http://" & RS("head") & """ target=""_blank"" class=""biglink"" >" & server.HTMLencode(RS("head")) & "</a></td>" & vbCrLf
If LinkCount=2 Then
Response.Write "</tr>"
LinkCount="0"
End If
RS.MoveNext
Loop
If LinkCount < 2 And Not LinkCount= 0 Then
Do until LinkCount=2
Response.Write "<td></td>"
LinkCount = LinkCount + 1
If LinkCount=2 Then
Response.Write "</tr>"
End If
Loop
End If
End If
RS=nothing ## DETTE er 66 ##
RS.close
Fejl:
Microsoft VBScript runtime error '800a005b'
Object variable not set: 'RS'
main_link.asp, line 66