public kocapage(koca a) { InitializeComponent(); ime_k = a.ime; takoca = a; }
public Form4(koca a) { InitializeComponent(); ime_koce = a.ime; takoca = a; }
private void kocelist_SelectedIndexChanged(object sender, EventArgs e) { if (kocelist.SelectedIndex == -1) { MessageBox.Show("Izberite koco!"); } else { koca a = koce[kocelist.SelectedIndex]; kocapage koca = new kocapage(a); koca.Show(); } }
private void search_Click(object sender, EventArgs e) { kocelist.Items.Clear(); koce.Clear(); using (NpgsqlConnection con = new NpgsqlConnection("Server=rogue.db.elephantsql.com; User Id=clhpojwc;" + "Password=wm7N_asXtodPaLSASbaFBEAcB1MtcKMU; Database=clhpojwc;")) { con.Open(); NpgsqlCommand com = new NpgsqlCommand("SELECT * FROM vsekoce_search('" + searchtext.Text + "')", con); NpgsqlDataReader reader = com.ExecuteReader(); while (reader.Read()) { koca a = new koca(reader.GetInt32(0), reader.GetString(1), reader.GetString(2), reader.GetInt32(3), reader.GetInt32(4)); kocelist.Items.Add(a.ime); koce.Add(a); } con.Close(); } }