Ver Mensaje Individual
  #1 (permalink)  
Antiguo 21/07/2011, 11:21
chamuco11
 
Fecha de Ingreso: agosto-2010
Ubicación: Rincon de Romos
Mensajes: 16
Antigüedad: 13 años, 8 meses
Puntos: 0
Pregunta Propiedad del calendar en asp

Tengo este codigo para guardar en una base de datos sql pero no se que propiedad se le pone al calendar para que me guarde en la base de datos lo que esta en rojo ahi va propiedad del calendar pra que me guarde en la bse de datos y me sale este error

error al registrarConversion failed when converting date and/or time from character string.



String strConexion;
String strSQL;
SqlConnection conexionSQL;
SqlCommand comandoSQL;

strConexion = "Data Source=GERARDO-PC\\GERARDO;" +
"Initial Catalog=Inmuebles;" +
"Integrated Security=True";

strSQL = "INSERT INTO m_inmuebles " +
"VALUES('"+Unidad_solicita.Text+"','"+
Area.Text + "','" +
Convert.ToString(Calendar1.SelectedDate)+ "','" +
Descripcion_servicio.SelectedItem.Text + "','" +
Prioridad_servicio.SelectedItem.Text +"','"+
Descripcion_breve.Text+"')";
conexionSQL=new SqlConnection(strConexion);

try
{
conexionSQL.Open();
comandoSQL = new SqlCommand(strSQL, conexionSQL);
comandoSQL.ExecuteNonQuery();
Label9.Visible = true;
Label9.Text = "El usuario se dio de alta correctamente";
}
catch (Exception ex)
{
Label9.Visible = true;
Label9.Text = "error al registrar" + ex.Message;
}
finally
{
conexionSQL.Close();
}
}

}

Última edición por chamuco11; 21/07/2011 a las 13:59