diff --git a/Oqtane.Client/Modules/Admin/Sql/Index.razor b/Oqtane.Client/Modules/Admin/Sql/Index.razor
index 9ff2d9b5..b22d279e 100644
--- a/Oqtane.Client/Modules/Admin/Sql/Index.razor
+++ b/Oqtane.Client/Modules/Admin/Sql/Index.razor
@@ -44,7 +44,7 @@ else
}
@@ -53,9 +53,31 @@ else
- @if (!string.IsNullOrEmpty(_results))
+ @if (_results != null)
{
- @((MarkupString)_results)
+ @if (_results.Count > 0)
+ {
+
+
+
+ @foreach (KeyValuePair kvp in _results.First())
+ {
+ @kvp.Key |
+ }
+
+
+ @foreach (KeyValuePair kvp in context)
+ {
+ @kvp.Value |
+ }
+
+
+
+ }
+ else
+ {
+ @Localizer["Return.NoResult"]
+ }
}
@@ -67,7 +89,7 @@ else
private string _database = string.Empty;
private string _connectionstring = string.Empty;
private string _sql = string.Empty;
- private string _results = string.Empty;
+ private List> _results;
public override SecurityAccessLevel SecurityAccessLevel => SecurityAccessLevel.Host;
@@ -114,7 +136,7 @@ else
{
var sqlquery = new SqlQuery { TenantId = int.Parse(_tenantid), Query = _sql };
sqlquery = await SqlService.ExecuteQueryAsync(sqlquery);
- _results = DisplayResults(sqlquery.Results);
+ _results = sqlquery.Results;
AddModuleMessage(Localizer["Success.QueryExecuted"], MessageType.Success);
}
else
@@ -128,44 +150,4 @@ else
AddModuleMessage(ex.Message, MessageType.Error);
}
}
-
- private string DisplayResults(List> results)
- {
- var table = string.Empty;
- foreach (Dictionary item in results)
- {
- if (table == string.Empty)
- {
- table = "";
- table += "
";
-
- foreach (KeyValuePair kvp in item)
- {
- table += "" + kvp.Key + " | ";
- }
-
- table += "
";
- }
-
- table += "";
-
- foreach (KeyValuePair kvp in item)
- {
- table += "" + kvp.Value + " | ";
- }
-
- table += "
";
- }
-
- if (table != string.Empty)
- {
- table += "
";
- }
- else
- {
- table = Localizer["Return.NoResult"];
- }
-
- return table;
- }
}