表已创建,但行为空,为什么?
MySqlConnection conn = new MySqlConnection("...");
conn.Open();
MySqlCommand cmd = new MySqlCommand("select id,id_user,status,id_delivery_method,delivery_method,id_payment_method,payment_method,payment_info,user_name,user_phone from `request`", conn);
DataTable dt = new DataTable();
dt.Load(cmd.ExecuteReader());
dataGrid1.ItemsSource = dt.DefaultView;
答案 0 :(得分:0)
尝试设置AutoGenerateColums = false
并自行定义列:
:
<DataGrid ... AutoGenerateColums="false">
<DataGrid.Columns><!-- Your columns --></DataGrid.Columns>
</DataGrid>
代码隐藏中的:
yourDatagrid.AutoGenerateColumns = false;