diff --git a/Views/Pages/SqlQueryPage.xaml b/Views/Pages/SqlQueryPage.xaml
index 83a0a5c..24a41e5 100644
--- a/Views/Pages/SqlQueryPage.xaml
+++ b/Views/Pages/SqlQueryPage.xaml
@@ -16,6 +16,7 @@
+
@@ -45,6 +46,7 @@
+
+
+
+
+
+ HorizontalAlignment="Stretch"
+ ColumnWidth="*"
+ hc:DataGridAttach.CanUnselectAllWithBlankArea="True"
+ ScrollViewer.HorizontalScrollBarVisibility="Auto"
+ MinColumnWidth="100" />
+
+
+
diff --git a/Views/Pages/SqlQueryPage.xaml.cs b/Views/Pages/SqlQueryPage.xaml.cs
index 0739eea..340e22b 100644
--- a/Views/Pages/SqlQueryPage.xaml.cs
+++ b/Views/Pages/SqlQueryPage.xaml.cs
@@ -44,6 +44,7 @@ namespace ExcelHelper.Views.Pages
// 替换 DuckDBDataAdapter 使用 DataTable.Load 方法
private void ExecuteButton_Click(object sender, RoutedEventArgs e)
{
+ StatusTextBlock.Text = "执行中...";
// 获取 SQL 查询文本
string sqlQuery = TextEditor.Text;
@@ -65,16 +66,28 @@ namespace ExcelHelper.Views.Pages
// 将结果绑定到 DataGrid
ResultDataGrid.ItemsSource = dataTable.DefaultView;
+ StatusTextBlock.Text = $"执行完成,共 {dataTable.Rows.Count} 行";
}
}
}
catch (Exception ex)
{
+ StatusTextBlock.Text = $"查询失败:{ex.Message}";
MessageBox.Show($"查询执行失败:{ex.Message}", "错误", MessageBoxButton.OK, MessageBoxImage.Error);
}
connection.Close();
}
}
+
+ private void FunctionListBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
+ {
+ if (FunctionListBox.SelectedItem is ListBoxItem item)
+ {
+ var functionText = item.Content.ToString();
+ var caretOffset = TextEditor.CaretOffset;
+ TextEditor.Document.Insert(caretOffset, functionText);
+ }
+ }
}
}