数据穿透

This commit is contained in:
geh
2026-03-06 14:24:20 +08:00
parent 474e208256
commit a05f640047
115 changed files with 14173 additions and 203 deletions
+37
View File
@@ -995,5 +995,42 @@ namespace BLL
maxId = GetIntValue(str);
return maxId;
}
/// <summary>
/// 执行SQL语句
/// </summary>
/// <param name="sql">sql语句</param>
public static bool ExecuteSql(string sql)
{
bool result = false;
using (SqlConnection Connection = new SqlConnection(connectionString))
{
try
{
result = true;
Connection.Open();
SqlCommand command = new SqlCommand(sql, Connection)
{
CommandTimeout = 0,
CommandType = CommandType.Text
};
command.ExecuteNonQuery();
}
catch (Exception ex)
{
result = false;
ErrLogInfo.WriteLog($"【执行SQL语句报错】{sql};【错误信息】{ex.Message}");
}
finally
{
Connection.Close();
}
return result;
}
}
}
}