Ejemplo n.º 1
0
 void guardarEstado()
 {
     using (SqlConnection sqlCon = new SqlConnection(connectionString))
     {
         sqlCon.Open();
         string     query  = "UPDATE inmueble SET estado=@estado WHERE inmueble_id=@inmueble_id";
         SqlCommand sqlCmd = new SqlCommand(query, sqlCon);
         sqlCmd.Parameters.AddWithValue("@estado", "Arrendado");
         sqlCmd.Parameters.AddWithValue("@inmueble_id", (TxtCodigoInmueble.FindControl("TxtCodigoInmueble") as TextBox).Text.Trim());
         sqlCmd.ExecuteNonQuery();
     }
 }
Ejemplo n.º 2
0
        void guardarContrato()
        {
            using (SqlConnection sqlCon = new SqlConnection(connectionString))
            {
                sqlCon.Open();
                string     query  = "INSERT INTO contrato (inmueble_id,persona_id) VALUES (@inmueble_id,@persona_id)";
                SqlCommand sqlCmd = new SqlCommand(query, sqlCon);
                sqlCmd.Parameters.AddWithValue("@inmueble_id", (TxtCodigoInmueble.FindControl("TxtCodigoInmueble") as TextBox).Text.Trim());
                sqlCmd.Parameters.AddWithValue("@persona_id", (TxtCodigoCliente.FindControl("TxtCodigoCliente") as TextBox).Text.Trim());
                sqlCmd.ExecuteNonQuery();

                lblSuccessMessage.Text    = "Registro Con Exito";
                lblSuccessMessage.Visible = true;
                lblErrorMessage.Text      = "";
                lblErrorMessage.Visible   = true;

                sqlCmd.Parameters.Clear();
            }
        }