Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public bool Upisi() //instancna metoda upisuje this objekat
- {
- SqlCommand cmd = Konekcija.GetCmd();
- cmd.CommandText = "uspRoditelj";
- cmd.Parameters.AddWithValue("@izbor", 1);
- if(this.SvojstvoID>0)
- cmd.Parameters.AddWithValue("@svojstvoID", this.SvojstvoID); //vodimo racuna kada prenosimo spoljasnji kljuc
- cmd.Parameters.AddWithValue("@ime", this.Ime);
- cmd.Parameters.AddWithValue("@prezime", this.Prezime);
- cmd.Parameters.AddWithValue("@adersa", this.Adresa);
- cmd.Parameters.AddWithValue("@fiksni", this.Fiksni);
- cmd.Parameters.AddWithValue("@mobilni", this.Mobilni);
- try
- {
- cmd.Connection.Open();
- int broj = cmd.ExecuteNonQuery();
- if (broj == 1) return true;
- else throw new Exception("roditelj nije upisan");
- }
- catch (Exception ex)
- {
- this.PorukaGreske = ex.Message;
- return false;
- }
- finally
- {
- cmd.Connection.Close();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement