11
This commit is contained in:
@@ -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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user