I make wpf database app and I want to select table from my database with combobox.
I have a database with ten tables. I can connect to the database and I can select/updata/insert... items from a table. I need to switched between tables. For examp, if I click to Table1, Table1 will selected, if I click to Table2, Table2 will selected. Combobox is good for my app, I believe. This is my code for select:
public MainWindow()
        {
            InitializeComponent();
            loadData();
        }
        public void loadData()
        {
            // vytvoření spojení
            MySqlConnection con = new MySqlConnection(spojeni);
            con.Open();
            MySqlCommand vybrat = con.CreateCommand();     
            vybrat.CommandText = "SELECT * FROM barva";        
            MySqlDataAdapter adapt = new MySqlDataAdapter(vybrat);        
            DataSet data = new DataSet();
            adapt.Fill(data);           
            dtGrid.ItemsSource = data.Tables[0].DefaultView;
          }
PS. I apologize for my English
 
     
     
    