In this paper, being based on the idea of dispersion-relation-preserving optimization, a class of high-order high-resolution upwind compact schemes with a free parameter and their consistent boundary scheme are proposed for the solution of the governing equations of the 2D double-diffusive convection. The first derivative and the second derivative, in the vorticity equation, the temperature equation and the concentration equation, are discretized by using the optimal upwind compact scheme on a uniform mesh and the fourth-order symmetrical Padé compact scheme, respectively. The pressure Poisson equation is approximated using a fourth-order compact difference scheme constructed currently on the nine-point two dimensional stencil. The fourth-order Runge-Kutta method is utilized for the temporal discretization. To assess numerical capability of the proposed algorithm, particularly its spatial behavior, the problems about the convection diffusion equation, the nonlinear Burgers equation and the nature convection flows in the square cavity with adiabatic horizontal walls and differentially heated vertical walls are computed by using the newly proposed algorithm. The numerical results are in excellent agreement with the benchmark solutions and some of the accurate results available in the literature, and show that effectiveness, accuracy and the advantage of better resolution of the present method. After that, steady and unsteady solutions for the double-diffusive convection in a rectangular cavity are also used to assess the efficiency of the present algorithm. The period of oscillation and flow field profiles are in great agreement with the data in the literature for buoyancy ratio, λ=1. The typical separation and secondary vortices at the bottom corner of the cavity as well as the top corner can be captured well for various buoyancy ratio. These indicate that the present method is suitable for simulating effectively the unsteady double-diffusive convection.