Advertisement
Guest User

Untitled

a guest
Jun 25th, 2019
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.26 KB | None | 0 0
  1. try
  2. {
  3. if (polaczenie.State == ConnectionState.Closed)
  4. polaczenie.Open();
  5.  
  6. zapytanieSQL = "select * from " + comboBox2.SelectedItem.ToString();
  7. komenda = new SQLiteCommand(zapytanieSQL, polaczenie);
  8. czytnik = komenda.ExecuteReader();
  9.  
  10.  
  11. if (czytnik.HasRows)
  12. {
  13. while (czytnik.Read())
  14. {
  15. //lista_roślin.Items.Add(string.Format("{0} - {1} - {2}", czytnik[0].ToString(), czytnik["Nazwa_polska"].ToString(), czytnik["Nazwa_łacińska"].ToString()));
  16. label2.Text = czytnik.GetString(1);
  17. label3.Text = czytnik.GetString(2);
  18. label4.Text = czytnik.GetString(3);
  19.  
  20. }
  21. czytnik.Close();
  22. }
  23. }
  24. catch (Exception ex)
  25. {
  26. string byk = string.Format("Błąd podczas pobierania danych:\n{0}", ex.Message);
  27. MessageBox.Show(byk, "Błąd", MessageBoxButtons.OK, MessageBoxIcon.Error);
  28. }
  29. finally
  30. {
  31. polaczenie.Close();
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement