Again, it depends. If the only evidence to prove you committed the crime is your statement, and your statement is thrown out because your Miranda rights were violated, the charges can be dismissed. However, if there is other evidence such as an eyewitnesses to the crime or DNA evidence, the charges will not be thrown out. The prosecutor will not be able to use your confession against you, but they can introduce the other evidence that was not taken in violation of your Constitutional rights.
What are my Miranda rights?
You have the right to remain silent, anything you say can be used against you in court, you have the right to consult with an attorney and have that attorney present during questioning. If you are unable to afford an attorney, an attorney will be provided to you at no cost. Before speaking to the police, speak to a criminal defense attorney.