Hi people, I try to set up a control button functionality to save the entry data to the database. I wrote the code in C# and when I try to use it I get no errors, but thay wont to save the data. Here is the code i hope that someone will halp me.
And finally the code:
private void btnSnimi_Click(object sender, EventArgs e) { this.korisnikBindingSource.EndEdit(); //this.BindingContext[dsAB1, "stud"].EndCurrentEdit(); if (this.katvDataSet1.HasChanges()/*this.dsAB1.HasChanges()*/) { try { if (konekcija.State == ConnectionState.Closed) { konekcija.Open(); MessageBox.Show("otvorena konekcija"); } korisnikTableAdapter.Update(katvDataSet1.korisnik); //sqlDAStud.Update(dsAB1, "stud"); MessageBox.Show("Snimljene sve izmjene!"); } catch (System.Exception eSnimi) { MessageBox.Show("GRESKA: " + eSnimi.Message); } finally { konekcija.Close(); }
} else { MessageBox.Show("Nema promjena za snimanje!"); } } |