1
我有一個SQLite數據庫,我希望從每條記錄讀取記錄並執行一段代碼。嘗試在while循環內捕獲
我使用了嘗試catch裏面While循環...
代碼如下: -
result = slcom.ExecuteReader()
'TODO: There is a problem with this while loop whereby if an ex is caught the connection
' to the database is closed.
While result.Read
Try
< do some stuff here >
Catch ex As Exception
incrementFailoverCount(result("fid"))
End Try
End While
result.Close()
的問題是,一旦進入Try塊與前任是被捕獲,while循環的下一次迭代失敗,因爲它似乎是一個ex被捕獲的時刻,與SQLite數據庫的連接被關閉,儘管連接屬性表明它已打開。
任何想法???
什麼是實際異常? – 2011-02-14 10:12:27