> Try > > ' Start time > lnDateNow = Date.Now.Ticks > > oDataAdapter.Fill(oDataSet) > > ' End time > lnDateNow2 = Date.Now.Ticks > > ' This means the command worked ok so we are ok to exit > Exit For > > Catch loError As Exception > > ' If this is the deadlock issue > If oApp.At("was deadlocked on lock ", loError.Message) > 0 Then > > ' If we have not reached the maximum tries of 10, we retry > If lnCounter < 5 Then > > If lnCounter > 1 Then > > ' Log an error > loInsertRow.cAlias = "Error" > loInsertRow.ParameterAdd("Message", "SQL Server deadlock issue " + lnCounter.ToString + " " + _ > loError.Message + oApp.cCR + oApp.cCR + ErrorDetail()) > loInsertRow.ParameterAdd("Page", oProcess.cPageFullName) > loInsertRow.ParameterAdd("QueryStrin", oProcess.cQueryString) > loInsertRow.ParameterAdd("StackTrace", "") > loInsertRow.ParameterAdd("IP", oProcess.cIP) > loInsertRow.ParameterAdd("NoLanguage", oProcess.nLanguage) > loInsertRow.ParameterAdd("Property", "") > If Not loInsertRow.InsertRow() Then > Return False > End If > > End If > > ' Wait for 1 second > System.Threading.Thread.Sleep(1000) > > Else > Return False > End If > > Else > > ' This is a regular error, so we have to let the system deals with it > > End If > > End Try >>