title: sql server index out of range error
body: <p>i have this error . The index 2 is out of range. on pst.setString(2, textField.getText();
  how can i deal with it. </p>
  
  <p>this is my code</p>
  
  <pre><code>try{
      String sql="update inventory set Name=?,Category=?,Brand=?,Price=?,ExDate=?,Tags=?,Quantity=?,Barcode=? where Id=?"; 
      pst.setString(2, textField.getText());
      pst.setString(3, textField_1.getText());
      pst.setString(4, textField_2.getText());
      pst.setString(5, textField_3.getText());
      pst.setString(6, textField_4.getText());
      pst.setString(7, textField_5.getText());
      pst.setString(8, textField_9.getText());
      pst.setString(9, textField_6.getText());
      pst.setString(1, textField_8.getText());
      pst=con.prepareStatement(sql);
      pst.executeUpdate();
  
      JOptionPane.showMessageDialog(null,"Updating Item Successful","Updated",JOptionPane.PLAIN_MESSAGE);
  
      new server().setVisible(true);
      setVisible(false);
  } catch(Exception e1){e1.printStackTrace();}
  </code></pre>