我有WINFORM,我想在运行时设置和绑定DataGridView的dataSource。
我有相同的代码,但它似乎不起作用
DataTable dtAppointmentForPrint = new DataTable();
GetAppointments(null, out dtAppointmentForPrint);
DataGridView temp = new DataGridView();
temp.AutoGenerateColumns = true;
temp.DataSource = dtAppointmentForPrint;
temp.Refresh();
当我在那里探索gridview的数据源时,列数为零。