2012-07-11 2 views
0

한 번 몇 백 번에 한 번씩 개체를 잃어버린 생명의 사이트에 오류가 발생했습니다. 나는 검사를하고 테스트를 해왔지만, 무엇이 잘못되었는지 실마리가 없습니다. 누구나 밝은 아이디어가 있습니까?개체 참조가 MYSQLcommand에있는 개체의 인스턴스로 설정되지 않았습니다.

코드는 :

Dim MySqlCommand = New MySqlCommand(SQLC, MySqlConnect) 
Try 
    Tries = 5 
    lg &= " Co(" 
    Do 
     Try : MySqlCommand.Connection.Open() 
     Catch ex As Exception 
      lg &= " " & ex.Message 
      Wait(0.5) 
     End Try 
     If (MySqlCommand.Connection.State <> ConnectionState.Open) Then Tries -= 1 
    Loop While Tries > 0 And MySqlCommand.Connection.State <> ConnectionState.Open 
    lg &= ")" 
Catch ex As Exception 
    lg &= ex.message 
End Try 

lg &= " " & LCase(Left(SQLC, 5)) & "(Mc" 

Try 
    lg &= "En" : Dim ret = MySqlCommand.ExecuteNonQuery() 
    lg = "" 
Catch ex As Exception 
    lg &= ":" & ex.message 
End Try 

if lg<>"" then Response.write(lg) 

출력은 :

CO() UPDAT (McEn :. 개체의 인스턴스로 설정되지 않은 개체 참조

답변

0

log4net과 같은 .net 로깅 프레임 워크를 사용하십시오. 귀하의 페이지에서 일어나는 일.

내 경험으로 로깅은 간헐적 인 버그를 잡는 가장 좋은 방법입니다.

관련 문제