A search is presented for the production of both first- and second-generation scalar leptoquarks with a final state of either two electrons and one jet or two muons and one jet. The search is based on a data sample of proton-proton collisions at center-of-mass energy s=8 TeV recorded with the CMS detector and corresponding to an integrated luminosity of 19.6 fb-1. Upper limits are set on both the first- and second-generation leptoquark production cross sections as functions of the leptoquark mass and the leptoquark couplings to a lepton and a quark. Results are compared with theoretical predictions to obtain lower limits on the leptoquark mass. At 95% confidence level, single production of first-generation leptoquarks with a coupling and branching fraction of 1.0 is excluded for masses below 1730 GeV, and second-generation leptoquarks with a coupling and branching fraction of 1.0 is excluded for masses below 530 GeV. These are the best overall limits on the production of first-generation leptoquarks to date.