JAVA高手帮帮忙?我的毕业设计有个小小的模块实现不了

来源:百度知道 编辑:UC知道 时间:2024/05/22 10:50:43
public void actionPerformed(ActionEvent e) {
if (e.getSource() == jButton1) {//jButton1是保存按钮
try {
saveInf();
this.dispose();
CustomInfInsert customInfInsert = new CustomInfInsert();
customInfInsert.setModal(true);
customInfInsert.setVisible(true);
} catch (Exception ee) {
JOptionPane.showMessageDialog(null, "客户编号重复或信息格式不正确", "提示信息",
JOptionPane.WARNING_MESSAGE);
return;
}
} }
public void saveInf() throws SQLException {
int s1 = this.s;
String s2 = "'" + jTextField2.getText().trim() +"'" ;
int index = jComboBox1.getSelectedIndex();
String s3=null;
if (index == 0) {
s3 = "'" + "男" + "'";
} else if (index == 1) {
s3 = "'" + "女" + "'";
}
String s4 = "'" + jTextFi

执行到
Stmt.executeUpdate(temp);
发生异常
通过
public void saveInf() throws SQLException
抛给调用它的函数
public void actionPerformed....
然后被其中的CATCH捕获.

发生这个异常不一定是 "客户编号重复或信息格式不正确" ,你可以用
ee.getMessage()来看看问题到底出在哪.

在catch块里写System.out.println(ee.getMessage());
看看异常信息

[Microsoft][SQLServer 2000 Driver for JDBC][SQLServer]在此上下文中不允许使用 '服务行业'。此处只允许使用常量、表达式或变量。不允许使用列名。

这是异常信息,我该怎么改??
谢谢啦