救命啊!!!老是报java.lang.StringIndexOutOfBoundsException: String index out of range: 16?????

beyondbyb 2005-12-27 10:50:54
我在 往SQLSERVER中循环插入1-1000的ID的时候老是报java.lang.StringIndexOutOfBoundsException: String index out of range: 16,代码如下:
try{
// connection= DriverManager.getConnection(url11,user11,password11);
connection.setAutoCommit(false);// 事物处理
for(i=0;i<sl;i++){
SQL="";
SQL="select card from newcard where card='"+qskh+"'";
rs=stmt.executeQuery(SQL);
if((rs!=null)&&(rs.next())){
out.println("<script>alert('卡号[ "+qskh+" ]已存在,请确认你要添加的卡段!');self.history.back();</script>");
}else{
SQL="";
SQL="insert into newcard(onlyid,card,lrfs,cardtype,nj,price,dls,ffsj,fffs,ffr) values('"+getOnlyID()+"','"+qskh+"','"+lrfs+"','"+cardtype+"','"+nj+"','"+price+"','未代理',GETDATE(),'"+fffs+"','"+ddd+"')";
connection= DriverManager.getConnection(url11,user11,password11);
stmt=connection.createStatement();
iTmp=stmt.executeUpdate(SQL);
SQL="";
}
qskh1=qskh1+1;
qskh=String.valueOf(qskh1);
SQL="";
}
if(iTmp>0){
out.println("<script language=javascript >alert('批量添加成功!');self.location.reload('addcard.jsp');</script>");
}else{
out.println("<script language=javascript >alert('批量添加失败,请检查你输入的数据格式是否正确!');self.history.back();</script>");
}

}catch(SQLException e){
out.print(e);
connection.rollback();
}
...全文
282 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
mydeman 2005-12-27
  • 打赏
  • 举报
回复
这段代码没有发现什么问题,是不是还有其他的代码?异常信息上面应该有发生错误的行号的。
这是一个维护版本,主要是bug修复: ** Bug * [MNG-4840] - Prerequisites is not working on m3 * [MNG-4913] - [regression] User properties override equally named POM properties of transitive dependencies * [MNG-4915] - Versions in pom.xml are not checked for invalid characters * [MNG-4918] - MavenProject#clone() doubles active profiles * [MNG-4919] - Plugin execution contributed by lifecycle mapping gets lost when same goal is bound multiple times * [MNG-4923] - [regression] java.lang.ClassNotFoundException: org.apache.maven.artifact.ArtifactStatus * [MNG-4925] - Mismanagement of container lookup realm can cause type incompatibilities for plugins looking up components by string * [MNG-4933] - With a resource directory as . maven raise an java.lang.StringIndexOutOfBoundsException:217 * [MNG-4941] - PluginDescriptorBuilder doesn't populate expression/default-value fields for mojo parameters * [MNG-4952] - [regression] RELEASE field of repository metadata is not updated upon repeated deployments * [MNG-4955] - [regression] Outdated remote snapshots are preferred over locally installed snapshots * [MNG-4960] - [regression] Make-like reactor mode does not build selected project when resuming from one of its prerequisites * [MNG-4966] - Preserve double slashes in the scm connection url - identifies absolute repository paths for mercurial ** Improvement * [MNG-4912] - Use of raw type should be Comparable * [MNG-4916] - Poor ProjectBuilder.build performance for projects with unresolvable extension plugins * [MNG-4922] - ExecutionEvent give on the exception encountered (when having mojoFailed) * [MNG-4926] - ExecutionEvent give on the exception encountered (when having projectFailed , forkedProjectFailed) * [MNG-4944] - Include JRE vendor in version info * [MNG-4950] - Javadoc improvements to DefaultSettingsWriter/Reader * [MNG-4953] - Issue a warning when a system-scope dependency refers to the project basedir ** New Feature * [MNG-4936] - Allow to better monitor and adjust a Maven build during CI * [MNG-4937] - Allow the platform scripts to avoid loading mavenrc content ** Task * [MNG-4945] - Remove mergeId from public POM * [MNG-4957] - Emit validation warning when project version uses irregular SNAPSHOT version string * [MNG-4959] - Update default plugin versions

81,092

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧