我m trying to show elements from my database "Worker" in a listbox in a WPF,I want to do this using a DataTable, I
检查过我的数据表包含数据库中的元素,问题是尝试在列表框中显示这些元素,列表框没有t show anything, it
只是空白。这是我的代码:
private void MainWindow_Loaded(object sender, RoutedEventArgs e)
{
cmd.Connection = con;
DataTable mydatatable = GetDataTable();
listBoxListNames.ItemsSource = mydatatable.ToString();
listBoxListNames.SelectedValuePath = "id";
listBoxListNames.DisplayMemberPath = "name".ToString();
ShowDatabase();
}