A selective synthesis of methyl d-glucopyranoside or furanoside has been developed using 2,4,6-trichloro-1,3,5-triazine (TCT)-activated DMSO and d-glucose in methanol. At higher concentrations of DMSO, only pyranoside was formed and at lower concentrations of DMSO, only furanoside was formed. This method was also successfully applied to other sugars. In terms of reaction rates, selectivities, and yields, this method is better than most of the currently used methods.