Advertisement
Guest User

Listázás

a guest
Nov 27th, 2016
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. MySqlConnection connection = new MySqlConnection("datasource=localhost;port=3306;username=root;password=root");
  2. MySqlDataAdapter adapter;
  3. DataTable table = new DataTable();
  4. adapter = new MySqlDataAdapter("SELECT * FROM onlypracticie_c.test", connection);
  5. adapter.Fill(table);
  6. listBox1.DataSource = table;
  7. listBox1.DisplayMember = "name";
  8. listBox1.ValueMember = "id";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement