tengo una tabla en c#
llena y quiero tomar esos datos por fila y agregarlos uno a uno a la base de dato por mysql
esto es lo que tengo
Código:
el primero lo agrega en el segundo me dice "Parameter '@referencia' has already been defined." CDetalle Detalle = new CDetalle(); DataGridViewRow celdaSeleccionada = new DataGridViewRow(); for (int i = 0; i < dataGridVenta.RowCount; i++) { celdaSeleccionada = dataGridVenta.Rows[i]; dataGridDetalle.AutoGenerateColumns = false; Detalle.refFaja = celdaSeleccionada.Cells[0].Value.ToString(); Detalle.Color_faja = celdaSeleccionada.Cells[1].Value.ToString(); Detalle.Talla_faja = celdaSeleccionada.Cells[2].Value.ToString(); Detalle.Total = double.Parse(celdaSeleccionada.Cells[3].Value.ToString()); Detalle.canPedido = int.Parse(celdaSeleccionada.Cells[4].Value.ToString()); Detalle.Cod_factura = int.Parse(textBoxCodFactura.Text); if (admin.RegistrarDetalle(Detalle)) { MessageBox.Show("Registro Exitoso :-)", "Confirmacion", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); LaEscoba(); } else { MessageBox.Show("Hubo Un Error En Su Registro \nPor Favor, Intente Nuevamente \n:-(", "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning); }