Using a first-principle method, the electronic structures and the impurity formation energy of ZnO, ZnO (N), ZnO (N+B), and ZnO (2N+B) have been calculated, based on which the feasibility to obtain p-type ZnO is discussed. According to the results, when ZnO is single doped by N, the acceptor level is deep, and the formation energy is negative, so the ideal p-type ZnO can not be obtained by this way. On the contrary, when 2N+B are codoped into ZnO, the acceptor level becomes much lower, and the formation energy is positive, so it is a better way to obtain p-type ZnO.