private void btn_continuar_Click(object sender, EventArgs e) { if (txt_codigoEnvio.Text == "" || Txt_DirInicial.Text == "" || txt_inicioTraslado.Text == "" || cmb_sedeDestino.SelectedIndex == -1 || cmb_direccionFinal.SelectedIndex == -1 || cmb_Placa.SelectedIndex == -1) { MessageBox.Show("llene todos los campos"); } else { txt_codigoTraslado.Enabled = true; txt_Descripcion.Enabled = true; txt_TotalProductos.Enabled = true; cmb_CodigoProducto.Enabled = true; cmb_CodigoEnvio.Enabled = true; try { OdbcConnection con = new OdbcConnection(ConnStr); OdbcCommand cmd = new OdbcCommand("insert into TBL_Envio_Encabezado values ('" + txt_codigoEnvio.Text + "', '" + txt_inicioTraslado.Text + "', '" + Txt_DirInicial.Text + "', '" + cmb_sedeDestino.Text.ToString() + "', '" + cmb_direccionFinal.Text.ToString() + "', '" + cmb_Placa.Text.ToString() + "')", con); con.Open(); cmd.ExecuteNonQuery(); con.Close(); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } cmb_CodigoProducto.DataSource = CapaDatos_TrasladoProductos.llenarCodProducto(); cmb_CodigoProducto.ValueMember = "PK_Codigo_Producto"; cmb_CodigoEnvio.DataSource = CapaDatos_TrasladoProductos.llenarCodEnvio(); cmb_CodigoEnvio.ValueMember = "PK_Codigo_Encabezado_Envio"; this.btn_continuar.Enabled = false; btn_Guardar.Enabled = true; } }
private void cmb_CodigoProducto_SelectedIndexChanged(object sender, EventArgs e) { dgv_mostrar.DataSource = CapaDatos_TrasladoProductos.llenarCodProducto(); }