How to create a ComboBox from SQLite?

You need to populate the ComboBox lines from SQLite DB, I can not understand what I'm doing wrong(
public SQLiteConnection cmb;

 private void comboBoxGroups_Selected(object sender, RoutedEventArgs e)
 Group group = new Group();

 using(var statement = cmb.Prepare("SELECT NameGroup FROM Groupt"))
 statement.Bind(1, group.NameGroup);


July 9th 19 at 13:18
1 answer
July 9th 19 at 13:20
First, get from the database in a table or collection the result of your query. Moreover, it is desirable not only names, but also the IDs SELECT ID,NameGroup FROM Groupt
Then in the DataSource property to specify where you data stuck. In the field NameGroup specify DisplayMember and ValueMember specify the ID.
Therefore, when the user selects a group Name, you will be able to read its ID.
This is for WinForms. For WPF is a little different.
P. S. I wrote from memory, could anywhere be wrong

Find more questions by tags C#SQLite