Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- try
- {
- if (polaczenie.State == ConnectionState.Closed)
- polaczenie.Open();
- zapytanieSQL = "select * from " + comboBox2.SelectedItem.ToString();
- komenda = new SQLiteCommand(zapytanieSQL, polaczenie);
- czytnik = komenda.ExecuteReader();
- if (czytnik.HasRows)
- {
- while (czytnik.Read())
- {
- //lista_roślin.Items.Add(string.Format("{0} - {1} - {2}", czytnik[0].ToString(), czytnik["Nazwa_polska"].ToString(), czytnik["Nazwa_łacińska"].ToString()));
- label2.Text = czytnik.GetString(1);
- label3.Text = czytnik.GetString(2);
- label4.Text = czytnik.GetString(3);
- }
- czytnik.Close();
- }
- }
- catch (Exception ex)
- {
- string byk = string.Format("Błąd podczas pobierania danych:\n{0}", ex.Message);
- MessageBox.Show(byk, "Błąd", MessageBoxButtons.OK, MessageBoxIcon.Error);
- }
- finally
- {
- polaczenie.Close();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement