我得到下面的异常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