4:54 PM PST -- A rep for Cosby says the the decision reached by the court was wrong, and they will appeal.
Bill Cosby will face trial in his sexual assault case because the judge just rejected his request for a dismissal.
Cosby's lawyer had argued he got a solid promise from the former D.A. in suburban Philadelphia ... that the comedian would NOT be prosecuted for allegedly sexually assaulting Andrea Constand.
Cosby claimed he agreed to sit for a deposition in Constand's civil case ONLY because of the D.A.'s promise, and that depo contained essential information about supplying drugs to women that led to the criminal filing.
Prosecutors had argued the former D.A. had no legal authority to make that secret agreement -- which Cosby and his attorneys never got in writing. The judge agreed and now the Constand case will move forward.
Preliminary hearing is tentatively scheduled to begin in about a month.