This commit is contained in:
gongxh
2022-05-16 09:03:42 +08:00
parent 4a6894457d
commit f3e77f63c0
37 changed files with 298 additions and 255 deletions

View File

@@ -47,38 +47,38 @@ namespace LeadDataBaseUtility
}
/// <summary>
/// 对SQLite数据库执行增删改操作,返回受影响的行数。
/// </summary>
/// <param name="sql">要执行的增删改的SQL语句</param>
/// <returns></returns>
public static int ExecuteSql(string sql)
{
int affectedRows = 0;
#if RELEASE
try
{
#endif
using (SQLiteConnection conn = new SQLiteConnection(connectionString))
{
conn.Open();
using (SQLiteCommand cmd = new SQLiteCommand(conn))
{
cmd.CommandText = sql;
affectedRows = cmd.ExecuteNonQuery();
}
conn.Close();
}
#if RELEASE
}
// /// <summary>
// /// 对SQLite数据库执行增删改操作,返回受影响的行数。
// /// </summary>
// /// <param name="sql">要执行的增删改的SQL语句</param>
// /// <returns></returns>
// public static int Execute(string sql)
// {
// int affectedRows = 0;
//#if RELEASE
// try
// {
//#endif
// using (SQLiteConnection conn = new SQLiteConnection(connectionString))
// {
// conn.Open();
// using (SQLiteCommand cmd = new SQLiteCommand(conn))
// {
// cmd.CommandText = sql;
// affectedRows = cmd.ExecuteNonQuery();
// }
// conn.Close();
// }
//#if RELEASE
// }
catch (Exception e)
{
LogHelper.WriteLog($"数据库运行异常:【{e.Message}】。SQL语句:【{sql}】。", LogTypeEum.DbErr);
}
#endif
return affectedRows;
}
// catch (Exception e)
// {
// LogHelper.WriteLog($"数据库运行异常:【{e.Message}】。SQL语句:【{sql}】。", LogTypeEum.DbErr);
// }
//#endif
// return affectedRows;
// }
public static IEnumerable<T> Query<T>(string Strsql, object Param = null)
{