private void edit_bt_Click(object sender, EventArgs e) { int obra_id = Int32.Parse(obras_dataGridView1.CurrentRow.Cells[0].Value.ToString()); data.connectToDB(); ObraModel tmp = new ObraModel(); //String sql = String.Format("SELECT * FROM proj_obras WHERE obra_id = '" + obra_id + "'"); SqlCommand com = new SqlCommand("getObrasById", data.connection()); com.CommandType = CommandType.StoredProcedure; com.Parameters.AddWithValue("@obra_id", obra_id); SqlDataReader reader; reader = com.ExecuteReader(); while (reader.Read()) { tmp.obra_id = Int32.Parse(reader["obra_id"].ToString()); tmp.data_ini = DateTime.Parse(reader["data_ini"].ToString()); tmp.data_fim = DateTime.Parse(reader["data_fim"].ToString()); tmp.orcamento = Int32.Parse(reader["orcamento"].ToString()); tmp.condominio = Decimal.Parse(reader["condominio"].ToString()); } data.close(); tmp.empresa = Decimal.Parse(obras_dataGridView1.CurrentRow.Cells[2].Value.ToString()); AddObra o = new AddObra(tmp); o.ShowDialog(this); }
private void add_bt_Click(object sender, EventArgs e) { AddObra obra = new AddObra(); obra.ShowDialog(this); }