Classic ASP 응용 프로그램에서 ASP_0147 오류가 발생하는 고객이 있습니다. 가장 먼저 체크하고있는 것은 SQL/ADO 리소스를 닫고 공개하는 것입니다.ADO 명령의 ActiveConnection = Nothing으로 기본 SQL 연결을 닫지 않습니까?
그들의 코드는 다음과 같은 패턴이 있습니다
Function GetXXXXRecordSet()
Set objConn = Server.CreateObject("ADODB.Connection")
With objConn
.CursorLocation = 3 ''adUseServer (default)
.ConnectionString = strConnectionString
.Open
End With
Set objCmd = Server.CreateObject("ADODB.Command")
Set objCmd.ActiveConnection = objConn
'' Build command object to call SQL stored proc, snipped for brevity
Set objRs = Server.CreateObject("ADODB.RecordSet")
objRs.Open objCmd, ,3,4 '' Cursor=adOpenStatic, Locktype=adLockBatchOptimistic
'' Return Recordset
Set GetXXXXRecordSet = objRs
If Not objCmd Is Nothing Then
objCmd.ActiveConnection = Nothing '' Should this use a Set statement?
Set objCmd = Nothing
End If
If Not ObjRs Is Nothing The Set objRs = Nothing
End Function
가 가까운 ADO 명령 집합의 ActiveConnection = 아무것도 설정하지 않는 기본 SQL 연결 또는 명시 적으로 폐쇄 할 필요가 않습니다?
또한해야 라인 :
objCmd.ActiveConnection = Nothing
될 :
Set objCmd.ActiveConnection = Nothing
가 이상하게 첫 번째 버전은 내가 왜 물어 오류를 생성하지 않습니다.
내가 ADO를보고 내 지식이 다소 녹슬었기 때문에 오래되었습니다.
다음과 같아야합니다. objCmd를 설정하십시오.ActiveConnection = Nothing really – Younes
@Kev : 연결을 추가했는지 궁금합니다. 위의 코드를 닫으면 문제가 해결됩니까? – AnthonyWJones
@AnthonyWJones - 추천을 고객에게 돌려주었습니다. 이제 기다려보아야합니다. – Kev