try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection conn= DriverManager.getConnection("jdbc:odbc:Driver={Microsoft Access Driver (*.mdb, *.accdb)};DBQ=D:\\DataBase1.mdb","","");
int id=Integer.parseInt(JOptionPane.showInputDialog("Enter ID"));
String name=JOptionPane.showInputDialog("Enter Name");
String Phone=JOptionPane.showInputDialog("Enter PHone");
String mobile=JOptionPane.showInputDialog("Enter Moblie");
//String sql="insert into friends values "id,'"+home
Statement ss=conn.createStatement();
ss.executeUpdate("insert into friends values("+id+",'"+name+"','"+Phone+"','"+mobile+"')");
Statement s=conn.createStatement();
ResultSet res=s.executeQuery("select*from friends order by id");
while(res.next()){
System.out.println(res.getString(1)+"\t"+res.getString(2)+"\t"+res.getString(3)+"\t"+res.getString(4));
}
}catch(Exception e){
JOptionPane.showMessageDialog(null, e.getMessage());
}
}
这是我的代码但是当我运行它时这个异常显示(“java.sql.SQLException: ??[Microsoft][ODBC Driver Manager] ???? ??? ???”)不知道是什么问题请帮忙???