Ver Mensaje Individual
  #1 (permalink)  
Antiguo 20/11/2012, 07:41
AJAPXD
 
Fecha de Ingreso: noviembre-2012
Mensajes: 1
Antigüedad: 11 años, 5 meses
Puntos: 0
Exclamación Rellenar una base de dato en mysql desde c# con un bucle for

Espero que halla alguien que pueda ayudarme
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:
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);
}
el primero lo agrega en el segundo me dice "Parameter '@referencia' has already been defined."