public static void Spremi(Tele t) { BP.otvoriKonekciju(); SQLiteCommand command = BP.konekcija.CreateCommand(); command.CommandText = String.Format(@"insert into Tele(Porod, HB_teleta, spol_teleta, HB_bika,datum_gonjenja, Broj_pokusaja, Opis) values('{0}', '{1}','{2}','{3}', '{4}','{5}', '{6}')", t.porod, t.hb_teleta, t.spol_teleta, t.hb_bika, t.datum_gonjenja, t.broj_pokusaja, t.opis); command.ExecuteNonQuery(); command.Dispose(); BP.zatvoriKonekciju(); }
private void button2_Click(object sender, EventArgs e) { try { Tele temp = new Tele(); temp.porod = dateTimePicker1.Value; temp.HB_teleta = textBox1.Text; temp.spol_teleta = textBox2.Text; temp.datum_gonjenja = dateTimePicker2.Value; temp.broj_pokusaja = numericUpDown1.Value; temp.opis = richTextBox1.Text; BPTele.Spremi(temp); MessageBox.Show("Spremljeno"); } catch (Exception ex) { MessageBox.Show(ex.Message); } }