help me!!
我对一张表尽心插入操作,然后,去取系统生成的id ,出现如下错误
javax.servlet.ServletException: [Microsoft][SQLServer 2000 Driver for JDBC]Invalid operation for the current cursor position.
at org.apache.struts.action.RequestProcessor.processException(RequestProcessor.java:526)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:467)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1422)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:523)
我得数据库操作如下
public String getStaffId(SignupForm form) throws Exception{
Connection con = CreateConnection.getConnection();
Statement smt = con.createStatement();
String COURSE_SYS_ID=Until.toGBK(form.getCOURSE_SYS_ID()) ;
String COURSE_CODE=Until.toGBK(form.getCOURSE_CODE());
String SIGN_DATE=form.getSIGN_DATE() ;
String Name=Until.toGBK(form.getName()) ;
String ID_CODE=Until.toGBK(form.getID_CODE() );
String PHONE=Until.toGBK(form.getPHONE()) ;
String BIRTH_DATE=Until.toGBK(form.getBIRTH_DATE());
String EMAIL=Until.toGBK(form.getEMAIL() );
String DIPLOMA=Until.toGBK(form.getDIPLOMA() );
String SPECIALTY=Until.toGBK(form.getSPECIALTY() );
String UNIT_ADDR=Until.toGBK(form.getUNIT_ADDR() );
String POST_CODE=Until.toGBK(form.getPOST_CODE() );
String JOB_RESUME=Until.toGBK(form.getJOB_RESUME() );
String SEX=Until.toGBK(form.getSEX() );
String EXER_STAFF_NAME=Until.toGBK(form.getEXER_STAFF_NAME() );
String RETAIN_UNIT_SYS_ID=Until.toGBK(form.getRETAIN_UNIT_SYS_ID());
String sql="select * from T_EXERCISE_STAFF where ID_CODE="+ID_CODE;
String sql1="insert into T_EXERCISE_STAFF (EXER_STAFF_NAME,ID_CODE,PHONE,EMAIL,DIPLOMA,SPECIALTY,POST_CODE,JOB_RESUME,SEX,RETAIN_UNIT_SYS_ID) values('"
+EXER_STAFF_NAME+"',"+
"'"+ID_CODE+"',"
+"'"+PHONE+"',"
+"'"+EMAIL+"',"
+"'"+DIPLOMA+"',"
+"'"+SPECIALTY+"',"
+"'"+POST_CODE+"',"
+"'"+JOB_RESUME+"',"
+"'"+SEX+"',"
+"'"+RETAIN_UNIT_SYS_ID+"')";
ResultSet rs=smt.executeQuery(sql) ;
if(rs.next() ){
String id=rs.getString(1);
System.out .println("system already exist the staff!!");
return id;
}
else{
System.out .println("insert record=========="+sql1);
smt.execute(sql1);
// con.commit();
rs=smt.executeQuery(sql);
String id=rs.getString(1);
con.close() ;
return id;
}
}
javax.servlet.ServletException: [Microsoft][SQLServer 2000 Driver for JDBC]Invalid operation for the current cursor position.
at org.apache.struts.action.RequestProcessor.processException(RequestProcessor.java:526)
at org.apache.struts.action.RequestProcessor.processActionPerform(RequestProcessor.java:467)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:274)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1422)
at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:523)
我得数据库操作如下
public String getStaffId(SignupForm form) throws Exception{
Connection con = CreateConnection.getConnection();
Statement smt = con.createStatement();
String COURSE_SYS_ID=Until.toGBK(form.getCOURSE_SYS_ID()) ;
String COURSE_CODE=Until.toGBK(form.getCOURSE_CODE());
String SIGN_DATE=form.getSIGN_DATE() ;
String Name=Until.toGBK(form.getName()) ;
String ID_CODE=Until.toGBK(form.getID_CODE() );
String PHONE=Until.toGBK(form.getPHONE()) ;
String BIRTH_DATE=Until.toGBK(form.getBIRTH_DATE());
String EMAIL=Until.toGBK(form.getEMAIL() );
String DIPLOMA=Until.toGBK(form.getDIPLOMA() );
String SPECIALTY=Until.toGBK(form.getSPECIALTY() );
String UNIT_ADDR=Until.toGBK(form.getUNIT_ADDR() );
String POST_CODE=Until.toGBK(form.getPOST_CODE() );
String JOB_RESUME=Until.toGBK(form.getJOB_RESUME() );
String SEX=Until.toGBK(form.getSEX() );
String EXER_STAFF_NAME=Until.toGBK(form.getEXER_STAFF_NAME() );
String RETAIN_UNIT_SYS_ID=Until.toGBK(form.getRETAIN_UNIT_SYS_ID());
String sql="select * from T_EXERCISE_STAFF where ID_CODE="+ID_CODE;
String sql1="insert into T_EXERCISE_STAFF (EXER_STAFF_NAME,ID_CODE,PHONE,EMAIL,DIPLOMA,SPECIALTY,POST_CODE,JOB_RESUME,SEX,RETAIN_UNIT_SYS_ID) values('"
+EXER_STAFF_NAME+"',"+
"'"+ID_CODE+"',"
+"'"+PHONE+"',"
+"'"+EMAIL+"',"
+"'"+DIPLOMA+"',"
+"'"+SPECIALTY+"',"
+"'"+POST_CODE+"',"
+"'"+JOB_RESUME+"',"
+"'"+SEX+"',"
+"'"+RETAIN_UNIT_SYS_ID+"')";
ResultSet rs=smt.executeQuery(sql) ;
if(rs.next() ){
String id=rs.getString(1);
System.out .println("system already exist the staff!!");
return id;
}
else{
System.out .println("insert record=========="+sql1);
smt.execute(sql1);
// con.commit();
rs=smt.executeQuery(sql);
String id=rs.getString(1);
con.close() ;
return id;
}
}
...全文
相关推荐
打开orcale服务器的脚本
have you ask me!! help me trying!!
slabbot:一种实验性的不和谐机器人,具有怪异的功能,无人问津
slabbot [='x'=] 一种实验性的不和谐机器人,具有怪异的功能,没人曾要求过。 搭载和 。 特征!! 无聊的命令,例如ping和help ! 基本的exp系统! (见me ) 一个decide事物之间关系的命令! 真正糟糕的despacito视频! ...以及其他一些令人震惊的事情。有关所有信息,请参见 。 怎么跑 下载存储库,提取文件, npm install等。您还需要设置mongodb数据库(默认情况下,它连接到mongodb://localhost:27017 。 然后,您需要在基本目录( index.js所在的目录)中创建一个config.json文件,该文件当前看起来像这样: { " token " : " your discord bot's token goes here " , " owner " : " your discord id go
jquery help me
jquery help me 网络技术 网络技术 网络技术 网络技术 网络技术
help-me-movie
最终项目 完整JavaScript个人项目。
POJ2996-Help Me with the Game
北大POJ2996-Help Me with the Game 解题报告+AC代码


