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