1,查询表名集合
SELECT name FROM sqlite_master WHERE type='table' ORDER BY name;
2,编程语言遍历删除
public static bool deleteAllData() { bool res = false; sqliteConnection conn = null; DbTransaction trans = null; try { string sql = "SELECT name FROM sqlite_master WHERE type='table' ORDER BY name"; DataSet ds = new DataSet(); ds = CommonBll.getDataSetBysql(sql,Constant.sqlITE_FLAG); if (ds != null && ds.Tables[0].Rows.Count > 0) { using (conn = sqliteHelper.GetConnection()) { var cmd = new sqliteCommand(conn); //开始事务 trans = conn.BeginTransaction(); //while (dr.Read()) for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { string dsql = "delete from " + ds.Tables[0].Rows[i][0].ToString(); cmd.CommandText = dsql; cmd.ExecuteNonQuery(); } //提交事务 trans.Commit(); Console.ReadLine(); //ds.Close(); //成功标识 res = true; } } } catch (Exception ex) { res = false; trans.Rollback(); } finally { trans.Dispose(); } return res; }原文链接:https://www.f2er.com/sqlite/199769.html