How to pass two parameter to a Query java
<p>So I am trying to execute a query that takes 2 int values from the user however I am getting this error message. What I am doing wrong?</p>

<p>"at least one parameter to the current statement is uninitialized"</p>

<p>This is my Query </p>

<pre><code>selectStudentsInRange = connection.prepareStatement("SELECT* FROM Results WHERE total BETWEEN ? AND ?"); 
</code></pre>

<p>An this is my method, yes is not the whole code. </p>

<pre><code>public List&lt; Results &gt; getTotalMarksInRange( int value1, int value2 )
 {
  List&lt; Results &gt; results = null;
  ResultSet resultSet = null;

  try 
  {
      selectStudentsInRange.setInt( value1, value2 ); // specify id

     // executeQuery returns ResultSet containing matching entries
     resultSet =  selectStudentsInRange.executeQuery(); 

     results = new ArrayList&lt; Results &gt;();
</code></pre>

<p>Please notice that this is not the whole code I have many classes I am just wondering what is my error in this part. </p>