Retrieving error codes from SQLite when using ExecuteNonQuery()

谁都会走 提交于 2019-11-28 13:03:48

use the Exception.StackTrace or the SQLiteException.ErrorCode

try
{

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

I'm going to add to this to help others, if you're developing in .NET. Use the

SQLiteErrorCode enumeration to test the result, cast the ErrorCode:

try
{

}
catch(SQLiteException ex)
{
    SQLiteErrorCode sqlLiteError= (SQLiteErrorCode)ex.ErrorCode;

    //Do whatever logic necessary based of the error type
}

Good question. System.Exception does not have a member by the name ".ErrorCode"

    Catch Ex As SQLiteException
        E = Ex.ResultCode
        Return E
    End Try
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!