第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

關(guān)于java.sql.SQLException: Can not issue data manipulation statements with executeQuery().

關(guān)于java.sql.SQLException: Can not issue data manipulation statements with executeQuery().

pstereo 2016-11-27 19:07:06
報出上面那個錯誤應(yīng)該怎么解決呢,急求!?。〕绦颍篿mport java.sql.Connection;import java.sql.DriverManager;import java.sql.PreparedStatement;import java.sql.ResultSet;import java.sql.SQLException;import java.sql.Statement;public class TestPrepareStatement {? public static void main(String[] args){ ?ResultSet rs=null;? Statement stmt=null;? Connection conn=null;? PreparedStatement pstmt=null;? try{? Class.forName("com.mysql.jdbc.Driver"); conn=DriverManager.getConnection("jdbc:mysql://localhost:3306/yuangong","root",""); stmt=conn.createStatement(); pstmt=conn.prepareStatement("insert into yuangongbiao values(?,?,?,?,?)"); /*添加的第一條記錄*/ pstmt.setInt(1, 1004); pstmt.setString(2, "Lily"); pstmt.setString(3, "Lily@126.com"); pstmt.setInt(4, 3600); pstmt.setString(5, "1999-02-13"); /*添加的第二條記錄*/ pstmt.setInt(1, 1005); pstmt.setString(2, "Li"); pstmt.setString(3, "Li@126.com"); pstmt.setInt(4, 3200); pstmt.setString(5, "1979-02-13"); /*添加的第三條記錄*/ pstmt.setInt(1, 1006); pstmt.setString(2, "Wang"); pstmt.setString(3, "Wang@126.com"); pstmt.setInt(4, 3000); pstmt.setString(5, "1994-02-13"); pstmt.executeQuery(); rs=stmt.executeQuery("select * from yuangongbiao"); while(rs.next()){ System.out.print(rs.getInt("employee_id")); System.out.print(rs.getString("name")); System.out.print(rs.getString("email")); System.out.print(rs.getInt("salaty")); System.out.print(rs.getString("birthday")); }? }catch(ClassNotFoundException e){? e.printStackTrace();? }catch(SQLException e){? e.printStackTrace();? }finally{? try{? if(rs!=null){? rs.close();? rs=null;? }? if(pstmt!=null){? pstmt.close();? pstmt=null;? }? if(stmt!=null){? stmt.close();? stmt=null;? }? if(conn!=null){? conn.close();? conn=null;? }? }catch(SQLException e){? e.printStackTrace();? }? } ?? }}
查看完整描述

1 回答

  • 1 回答
  • 0 關(guān)注
  • 4077 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學(xué)習(xí)伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號