The order authorized by section 29-01-17 is a bar to another prosecution for the same offense.
N.D.C.C. § 29-01-18