//在设置DbContext时,不会有异常抛出(如:链接字符串中,指定的数据库文件不存在),只有在执行sql语句时才能捕获异常信息
IDbContext dbContext= new DbContext().ConnectionStringName("SqliteConnString", new SqliteProvider());
try
{
List<DataTable> users = dbContext.Sql("select * from user").QueryMany<DataTable>();
}
catch (SQLiteException ex)
{
System.Diagnostics.Debug.WriteLine(ex.ToString());
MessageBox.Show(ex.ToString());
}
时间: 2024-10-14 07:36:15