jsp数据库取出数据再存入到另一个表中
Class.forName("com.mysql.jdbc.Driver");Connectioncon=DriverManager.getConnection("jdb...
Class.forName("com.mysql.jdbc.Driver");
Connection con=DriverManager.getConnection("jdbc:mysql://localhost:3306/library","root","zhoujie");
Statement sta=con.createStatement();
String sql="select * from bookinfo where bookid='"+bookno1+"'";
ResultSet res=sta.executeQuery(sql);
while(res.next()){
String bookid=res.getString(1);
String bookname=res.getString(2);
String price=res.getString(3);
String booktime=res.getString(4);
Class.forName("com.mysql.jdbc.Driver");
Connection con1=DriverManager.getConnection("jdbc:mysql://localhost:3306/library","root","zhoujie");
Statement sta1=con1.createStatement();
String sqlq="insert into delbookmes"+
"(bookid,bookname,price,in_time,time)"+
" values('"+bookid+"','"+bookname+"','"+price+"','"+booktime+"','"+time+"')";
ResultSet coun=sta.executeQuery(sqlq);
哪错了???? 展开
Connection con=DriverManager.getConnection("jdbc:mysql://localhost:3306/library","root","zhoujie");
Statement sta=con.createStatement();
String sql="select * from bookinfo where bookid='"+bookno1+"'";
ResultSet res=sta.executeQuery(sql);
while(res.next()){
String bookid=res.getString(1);
String bookname=res.getString(2);
String price=res.getString(3);
String booktime=res.getString(4);
Class.forName("com.mysql.jdbc.Driver");
Connection con1=DriverManager.getConnection("jdbc:mysql://localhost:3306/library","root","zhoujie");
Statement sta1=con1.createStatement();
String sqlq="insert into delbookmes"+
"(bookid,bookname,price,in_time,time)"+
" values('"+bookid+"','"+bookname+"','"+price+"','"+booktime+"','"+time+"')";
ResultSet coun=sta.executeQuery(sqlq);
哪错了???? 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询