c# - 具有 autogeneratecolumns 的 DataGrid 中的列名显示错误
问题描述
我正在编写一个 WPF 应用程序,它应该从 ORACLE 检索数据并使用 autogeneratecolumns 在 DataGrid 中显示它。问题是某些列名被简单地歪曲了。示例而不是 INITIATE_DATE 仅显示 INITIATEDATE。主要是下划线被忽略。谢谢您的帮助。
<Window x:Class="OPEN_ORDERS_ORACLE_TABLE.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xml:lang="de-DE"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:OPEN_ORDERS_ORACLE_TABLE"
mc:Ignorable="d"
Title="MainWindow" Height="450" Width="800" Loaded="Window_Loaded">
<Grid Height="419" VerticalAlignment="Top">
<DataGrid x:Name ="DataGrid1" ItemsSource="{Binding}" Margin="10,40,10,70"/>
</Grid>
</Window>
private void Window_Loaded(object sender, RoutedEventArgs e)
{
try
{
String connectionString = "Data Source=DWH; User Id=readonly; Password=*********;";
OracleConnection con = new OracleConnection();
con.ConnectionString = connectionString;
con.Open();
OracleCommand cmd = con.CreateCommand();
cmd.CommandText = "SELECT * FROM AFTERSALES.TBL_OPEN_ORDERS";
cmd.CommandType = CommandType.Text;
OracleDataReader dr = cmd.ExecuteReader();
DataTable dt = new DataTable();
dt.Load(dr);
DataGrid1.ItemsSource = dt.DefaultView;
dr.Close();
con.Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
}
解决方案
推荐阅读
- asp.net - 在 updatePanel 内时,引导工具提示颜色发生了变化
- git - Gitlab:更改历史后无法强制推送(预接收挂钩被拒绝)
- laravel - 将 Blade If Else 转换为 Vue If Else
- python - Cloud Jupter 笔记本 Numpy .so 文件“无法从共享对象映射段”
- amazon-web-services - AWS Cognito 用户池需要在 CF 模板部署后在控制台中手动保存
- numpy - 产品的有效总和
- reactjs - 使用 react-spring 反应打字稿类型错误
- gitlab - Gitlab wiki 搜索结果显示 markdown 语法
- email - msgraph api,通过搜索字符串过滤共享邮箱
- c# - 在堆积条形图上获取平均值而不是总计?