/*private void btnUpdate_Click(object sender, EventArgs e) { Connection con = new Connection(); if (con.ExecutaComando(Comandos.Update(Convert.ToInt32(dgvcliente.CurrentRow.Cells["id"].Value))) == true) { CarregarGRid(); } }*/ private void dgvcliente_DoubleClick(object sender, EventArgs e) { Connection con = new Connection(); Comandos.getbyId(Convert.ToInt32(dgvcliente.CurrentRow.Cells["id"].Value)); DataRow linhaCliente = null; Cliente cliente = null; string cmd; cmd = Comandos.getbyId(Convert.ToInt32(dgvcliente.CurrentRow.Cells["id"].Value)); if ((linhaCliente = con.ExecutaConsulta(cmd).Rows[0])!= null) { cliente = new Cliente(); cliente.id = Convert.ToInt32(linhaCliente["id"]); cliente.name = linhaCliente["name"].ToString(); cliente.lastname = linhaCliente["lastname"].ToString(); cliente.city = linhaCliente["city"].ToString(); cliente.estado = linhaCliente["estado"].ToString(); populatxt(objeto: cliente); } }
private void CarregarGRid() { Connection con = new Connection(); dgvcliente.DataSource = con.ExecutaConsulta(Comandos.Select()); }