public AddEditGateoForm(int _gateo_id, int hosp_id) { InitializeComponent(); edit = true; gateo_id = _gateo_id; toEdit = dbQuery.getGateoToEdit(_gateo_id); rtxtGandeste.Text = toEdit.gandeste; rtxtAnalize.Text = toEdit.analize; rtxtTratament.Text = toEdit.tratament; rtxtEvolutie.Text = toEdit.evolutie; rtxtObservatii.Text = toEdit.observatii; }
internal static Gateo getGateoToEdit(int gateo_id) { Gateo gateoToEdit = null; string editGateoComm = "select * from gateo where id_gateo=" + gateo_id + ";"; MySqlConnection conn = new MySqlConnection(connString()); MySqlCommand command = new MySqlCommand(editGateoComm, conn); conn.Open(); MySqlDataReader reader = command.ExecuteReader(); while (reader.Read()) { gateoToEdit = new Gateo(reader.GetInt32(0), reader.GetDateTime(1), reader.GetInt32(2), reader.GetString(3), reader.GetString(4), reader.GetString(5), reader.GetString(6), reader.GetString(7)); } reader.Close(); conn.Close(); return(gateoToEdit); }