这是我的员工注册表。在运行我的代码时,将显示错误
请说明理由和解决方案
CREATE TABLE "EMPLOYEE_REGISTRATION"
( "SALUTATION" VARCHAR2(4000),
"FIRSTNAME" VARCHAR2(4000),
"MIDDLENAME" VARCHAR2(4000),
"LASTNAME" VARCHAR2(4000),
"USERNAME" VARCHAR2(4000),
"PASSWORD" VARCHAR2(4000),
"MARITALSTATUS" VARCHAR2(4000),
"DATEOFBIRTH" DATE,
"MOB-STD" VARCHAR2(4000),
"MOBILENUMBER" NUMBER(30,0),
"STD" VARCHAR2(4000),
"TELEPHONENUMBER" NUMBER(30,0),
"EMAIL" VARCHAR2(4000),
"LANGUAGE" VARCHAR2(4000),
"MOTHERSMAIDEN" VARCHAR2(4000),
"CURRENTADDRESS" VARCHAR2(4000),
"PERMANENTADDRESS" VARCHAR2(4000),
"STATE" VARCHAR2(4000),
"CITY" VARCHAR2(4000),
"OCCUPATION" VARCHAR2(4000),
"EDUCATION" VARCHAR2(4000),
"EMPID" NUMBER(30,0),
"COMPANYNAME" VARCHAR2(4000),
"ANNUALINCOME" VARCHAR2(4000),
"SOURCEOFFUNDS" VARCHAR2(4000),
"DRIVINGLISCENCE" VARCHAR2(4000),
"PAYROLL" VARCHAR2(4000),
"PANCARD" VARCHAR2(4000),
"AADHARNUMBER" VARCHAR2(4000),
"EMPSTATUS" VARCHAR2(4000),
"HIREDDATE" DATE
)
这是我在netbeans中使用swing组件的代码:
private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
if (evt.getSource() == jButton1)
{
int x = 0;
String s1 = jTextField2.getText();//firstname
String s2 = jComboBox1.getSelectedItem().toString();//salutation
String s3 = jTextField3.getText();//middlename
String s4 = jTextField4.getText();//last name
String s5 = jTextField5.getText();//username
char[] s6 = jPasswordField1.getPassword();//password
char[] s7 = jPasswordField2.getPassword(); //confirm password
String s8 = new String(s6);
String s9 = new String(s7);
String s10= jComboBox3.getSelectedItem().toString();//marital status
//SimpleDateFormat df=new SimpleDateFormat("mm/dd/yyyy");
//dateChooserCombo1.setDateFormat("mm/dd/yyyy");
String s11=dateChooserCombo1.getDateFormat().toString();
String s12= jTextField6.getText();//+91
String s13= jTextField7.getText();//Mobile
String s14= jTextField8.getText();//std
String s15= jTextField9.getText();//telephone
String s16= jTextField10.getText();//email
String s17= jComboBox4.getSelectedItem().toString();//prefered language
String s18= jTextField13.getText();//mother's maiden name
String s19= jTextArea1.getText();//current address
//String s20= jCheckBox1.getSelectedIcon().toString();//same address
String s21=jTextArea2.getText();//permanent address
String s22= jComboBox5.getSelectedItem().toString();//state
String s23= jComboBox6.getSelectedItem().toString();//city
String s24= jComboBox7.getSelectedItem().toString();//occupation
String s25= jComboBox8.getSelectedItem().toString();//education
String s26= jTextField1.getText();//emp id
String s27= jTextField14.getText();//company name
String s28= jComboBox9.getSelectedItem().toString();//annual income
String s29= jComboBox10.getSelectedItem().toString();//source of funds
String s30= jTextField11.getText();//liscence number
String s31= jComboBox11.getSelectedItem().toString();//payroll mode
String s32= jTextField15.getText();//PAN number
String s33= jTextField16.getText();//aadhar number
String s34= jComboBox2.getSelectedItem().toString();//Status
String s35= jTextField17.getText();//hired date
if (s8.equals(s9))
{
try
{
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:XE", "system", "oracle");
PreparedStatement ps = con.prepareStatement("insert into employee_registration values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)");
ps.setString(1, s2);//salutation
ps.setString(2, s1);//fname
ps.setString(3, s3);//midname
ps.setString(4, s4);//lastname
ps.setString(5, s5);//username
ps.setString(6, s8);//password
ps.setString(7, s10);//marital status
ps.setString(8, s11);//date of birth
ps.setString(9, s12);//+91
ps.setString(10, s13);//mobile
ps.setString(11, s14);//std
ps.setString(12, s15);//telephone
ps.setString(13, s16);//email
ps.setString(14, s17);//lang
ps.setString(15, s18);//mothers maiden
ps.setString(16, s19);//current address
ps.setString(17, s21);//permanent address
ps.setString(18, s22);//state
ps.setString(19, s23);//city
ps.setString(20, s24);//occupation
ps.setString(21, s25);//education
ps.setString(22, s26);//empid
ps.setString(23, s27);//company
ps.setString(24, s28);//income
ps.setString(25, s29);//source of funds
ps.setString(26, s30);//driving liscence
ps.setString(27, s31);//payroll
ps.setString(28, s32);//pan
ps.setString(29, s33);//aadhar
ps.setString(30, s34);//emp status
ps.setString(31, s35);//hired date
ResultSet rs = ps.executeQuery();
x++;
if (x > 0)
{
JOptionPane.showMessageDialog(jButton1, "Data Saved Successfully");
}
}
catch (Exception ex)
{
System.out.println(ex);
}
if (jCheckBox1.isSelected()) {
JOptionPane.showMessageDialog(jCheckBox1,"JCheckBox is selected");
} else {
JOptionPane.showMessageDialog(jCheckBox1,"JCheckBox is NOT selected");
}
}
else
{
JOptionPane.showMessageDialog(jButton1, "Password Does Not Match");
}
}
else
{
jTextField1.setText("");
jTextField2.setText("");
jPasswordField1.setText("");
jPasswordField2.setText("");
jTextField3.setText("");
jTextField4.setText("");
jTextField5.setText("");
jTextField6.setText("");
jTextField7.setText("");
jTextField8.setText("");
jTextField9.setText("");
jTextField10.setText("");
jTextField11.setText("");
//jTextField12.setText("");
jTextField13.setText("");
jTextField14.setText("");
jTextField15.setText("");
jTextField16.setText("");
jTextField17.setText("");
}
}
运行时显示错误
java.sql.SQLDataException:ORA-01858:找到了数字所在的非数字字符