title: Index of 3 is out of range
body: <p>I'm new to this forum and also new to SQL.</p>
  
  <p>I've a problem with the below code of mine.</p>
  
  <p>Its throwing an error of <code>SQLException</code> which is <code>the index 3 is out of range</code></p>
  
  <p>I don't know what's the problem.</p>
  
  <pre><code>public static ArrayList&lt;LotInfoVO&gt; getLotInfoRecords3(String studName,String DoubleCheck, String lngstudid) throws ClassNotFoundException {
          {
              ArrayList &lt;LotInfoVO&gt; lotRecords4 = new ArrayList&lt;LotInfoVO&gt;();
              try {
                  Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver");
                  PreparedStatement stmt = getCon().prepareStatement("SELECT * FROM MesLib.tblSchoolRecordsr where strstudName = ? and strDoubleCheckCode = ? and (lngstudID NOT LIKE '-[^0-9]') ");
                  stmt.setString(1, studName);
                  stmt.setString(2, DoubleCheck);
                  stmt.setString(3, lngstudID);
  
                  ResultSet rs = stmt.executeQuery();
                  while(rs.next()) {
                      LotInfoVO voLotInfo3 = new LotInfoVO();
                      voLotInfo3.setStstudName(rs.getString("strstudName"));
                      voLotInfo3.setLngStudID(rs.getString("lngStudID"));
                      voLotInfo3.setLngStudSubID(rs.getString("lngStudSubID"));
                      voLotInfo3.setStrDoubleCheckCode(rs.getString("strDoubleCheckCode"));
                      voLotInfo3.setStrPackage(rs.getString("strCourse"));
                      voLotInfo3.setStrDimension(rs.getString("strSchool"));
                      voLotInfo3.setStrLead(rs.getString("strSubjects"));
                      //get values for other instance variables
                      lotRecords4.add(voLotInfo3);
                  }
              } catch (SQLException e) {
                  e.printStackTrace();
              }  finally {
                  closeConnection();
              }
              return lotRecords4;
          }
      }
  </code></pre>
  
  <p>Sorry for my coding I'm just a new programmer in town..</p>
  
  <p>So please be good to me thanks! </p>