Ver Mensaje Individual
  #1 (permalink)  
Antiguo 15/06/2011, 13:36
Avatar de SNAM
SNAM
 
Fecha de Ingreso: junio-2011
Mensajes: 22
Antigüedad: 12 años, 11 meses
Puntos: 0
Insertar Fecha desde c# a mysql

hola que tal
tengo un problema al tratar de insertar una fecha la cual selecciono con un dateTimePicker a un campo en una bd de mysql, si me hace la insercion pero me guarda el campo como "0000-00-00 00:00:00"
Código:
string varNombre = txtNomProyecto.Text;
int varIdAsociado = int.Parse(cbAsociado.SelectedValue.ToString());
int varIdServicos = fkServicios;
DateTime varFeInicio = dtpFeInicio.Value;
DateTime varFeEntrega = dtpFeEntrega.Value;
DateTime varFeliberacion = dtpFeLiberacion.Value;
decimal varTotal = decimal.Parse(txtTotal.Text);
int varPagos = int.Parse(txtNoPagos.Text);
string varPropuesta = txtPropuesta.Text;
string varConvenio = txtConvenio.Text;
string varCronograma = txtCronograma.Text;

string insert = "INSERT INTO proyectos VALUES ('NULL','" + varNombre + "','" + varIdAsociado + "','" + varIdServicos + "','" + varFeInicio + "','" + varFeEntrega + "','" + varFeliberacion + "','" + varTotal + "','" + varPagos + "','" + varPropuesta + "','" + varConvenio + "','" + varCronograma + "')";
MySqlCommand comando = new MySqlCommand(insert, conexion);
comando.ExecuteNonQuery();
espero y me puedan ayudar, de antemano gracias