使用ExecuteNonQuery()时从SQLite检索错误代码

在我的C#项目中,我正在使用从CodeProject下载的System.Data.SQLite.dll

我的问题是根据标题 – 如何在调用SqliteCommand.ExecuteNonQuery()函数后获取错误代码?

错误代码,如SQLITE_CONSTRAINT, SQLITE_BUSY, SQLITE_LOCKED ,如下所示。

使用Exception.StackTrace或SQLiteException.ErrorCode

 try { } catch(SQLiteException ex) { string code = ex.ErrorCode; } 

好问题。 System.Exception没有名称为“.ErrorCode”的成员

  Catch Ex As SQLiteException E = Ex.ResultCode Return E End Try