我得到下面的異常java.lang.NumberFormatException:ForInputString 「7110332507339」 值java.sql.SQLException:丟失IN或OUT參數在指數:4
1)java.lang.NumberFormatException:ForInputString」 7110332507339"
2)值java.sql.SQLException:缺少IN或OUT參數在指數:4
即使我給在輸入的時間正確的數據。我已經搜尋了很多來解決這個問題,但仍然得到例外。這裏是我的code.my與數據類型的數據庫列也附在圖片 任何人都可以建議我一個解決方案嗎?由於
try{
Class.forName("oracle.jdbc.OracleDriver");
try (Connection conn =
DriverManager.getConnection(
"jdbc:oracle:thin:@localhost:1521:XE","hr","123"))
{
String qry1 = "insert into storeStaff
values(?,?,?,?,?,?,?,?,?)";
try {
pstmnt=conn.prepareStatement(qry1);
String EID=employeID.getText();
pstmnt.setString(1,EID);
String ename=name.getText();
pstmnt.setString(2,ename);
String efname=fatherName.getText();
pstmnt.setString(3,efname);
try{ String emcnic=cnic.getText();
int ecnic=Integer.parseInt(emcnic);
pstmnt.setInt(4,ecnic);}catch(Exception q)
{JOptionPane.showMessageDialog(null,q);}
String edob=dob.getText();
pstmnt.setString(5,edob);
String adress=address.getText();
pstmnt.setString(6,adress);
username.setText(EID);
pstmnt.setString(7,EID);
String pwd=password.getText();
pstmnt.setString(8,pwd);
String post=facultyChoice.getItem(facultyChoice.getSelectedIndex());
pstmnt.setString(9,post);
pstmnt.executeQuery();
if(EID!= null && ename!=null
&& efname!=null &&edob!=null && adress!=null && post!=null){
JOptionPane.showMessageDialog(null, "Added");
}
} catch (SQLException eex)
{JOptionPane.showMessageDialog(null,"Error"+eex);}}
} catch (SQLException exx)
{JOptionPane.showMessageDialog(null,"Error"+exx);} catch
(ClassNotFoundException ex) {
JOptionPane.showMessageDialog(null,"Error"+ex);
}}
可以請你的數據類型添加數據庫列在你的問題? – sForSujit
編輯問題後添加在圖片中@sForSujit –
謝謝,我會研究它 – sForSujit