protected void Button2_Click(object sender, EventArgs e) { Calificacion objCalificacion = new Calificacion(); objCalificacion.pregunta1 = Convert.ToInt32(c1.Value); objCalificacion.pregunta2 = Convert.ToInt32(c2.Value); objCalificacion.pregunta3 = Convert.ToInt32(c3.Value); objCalificacion.pregunta4 = Convert.ToInt32(c4.Value); objCalificacion.pregunta5 = Convert.ToInt32(c5.Value); objCalificacion.serial = Label13.Text; if (objCalificacion.serial == "Label") { } else { objCalificacion = objGestion.insertarCalificacion(objCalificacion); } }
public Calificacion insertarCalificacion(Calificacion calificacion) { SqlConnectionStringBuilder builder = new SqlConnectionStringBuilder { DataSource = "lincecars123.database.windows.net", UserID = "admin123", Password = "******", InitialCatalog = "linceCars" }; using (SqlConnection connection = new SqlConnection(builder.ConnectionString)) { connection.Open(); SqlCommand comando = new SqlCommand(); comando.Connection = connection; comando.CommandText = "exec sp_CalificarVehiculo " + calificacion.pregunta1 + "," + calificacion.pregunta2 + "," + calificacion.pregunta3 + "," + calificacion.pregunta4 + "," + calificacion.pregunta5 + "," + '"' + calificacion.serial + '"'; comando.ExecuteNonQuery(); } return(calificacion); }