语法错误,将"}"插入到完整 语句 中
packagemyaddressbody;importjava.awt.event.ActionEvent;importjava.awt.event.ActionList...
package myaddressbody;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.Statement;
import javax.swing.JButton;import javax.swing.JOptionPane;
public class Dlframeaction implements ActionListener {
@Override
public void actionPerformed(ActionEvent e){
// TODO 自动生成的方法存根
String dburl = "jdbc:odbc:driver={Microsoft Access Driver (*.mdb)};DBQ=main.mdb";
String sql;
Connection con;
Statement stmt;
Dlframe.delFrame.setVisible(false);
if (((JButton) e.getSource()).getText().equals("删除")){
String nn = Dlframe.lbDel.getText();
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
} catch (java.lang.ClassNotFoundException e2) {
System.err.print("ClassNotFoundException:");
System.err.println(e2.getMessage());}
try {
con = DriverManager.getConnection(dburl, "", "");
stmt = con.createStatement();
sql = "delete from address where 姓名=" + "\'" + nn + "\'";
stmt.executeUpdate(sql);
JOptionPane.showMessageDialog(null, "删除成功");
stmt.close();
con.close();
} catch (Exception ex) {
System.out.println("Exception:" + ex.getMessage());
}
Dlframe.lbDel.setText("");
}
if (((JButton) e.getSource()).getText().equals("放弃")){
Dlframe.delFrame.setVisible(false); /*这里提示‘语法错误,将"}"插入到完整 语句 中’*/
}
}
}
高手帮忙修改一下啊!
“/*这里提示‘语法错误,将"}"插入到完整 语句 中’*/”是注释,不是程序的代码。 展开
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.Statement;
import javax.swing.JButton;import javax.swing.JOptionPane;
public class Dlframeaction implements ActionListener {
@Override
public void actionPerformed(ActionEvent e){
// TODO 自动生成的方法存根
String dburl = "jdbc:odbc:driver={Microsoft Access Driver (*.mdb)};DBQ=main.mdb";
String sql;
Connection con;
Statement stmt;
Dlframe.delFrame.setVisible(false);
if (((JButton) e.getSource()).getText().equals("删除")){
String nn = Dlframe.lbDel.getText();
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
} catch (java.lang.ClassNotFoundException e2) {
System.err.print("ClassNotFoundException:");
System.err.println(e2.getMessage());}
try {
con = DriverManager.getConnection(dburl, "", "");
stmt = con.createStatement();
sql = "delete from address where 姓名=" + "\'" + nn + "\'";
stmt.executeUpdate(sql);
JOptionPane.showMessageDialog(null, "删除成功");
stmt.close();
con.close();
} catch (Exception ex) {
System.out.println("Exception:" + ex.getMessage());
}
Dlframe.lbDel.setText("");
}
if (((JButton) e.getSource()).getText().equals("放弃")){
Dlframe.delFrame.setVisible(false); /*这里提示‘语法错误,将"}"插入到完整 语句 中’*/
}
}
}
高手帮忙修改一下啊!
“/*这里提示‘语法错误,将"}"插入到完整 语句 中’*/”是注释,不是程序的代码。 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询