if(e.getSource()==bt1){//这是关键的代码,rt为整型变量
//tf1.setText("hello,world");
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
}catch(ClassNotFoundException ev){}
try{
con=DriverManager.getConnection("jdbc:odbc:demo","test","123");
sql=con.createStatement();
rt=sql.executeUpdate("INSERT INTO biao VALUES('12345','cen',89,89)");//这句好像不执行
con.commit();
con.close();
}catch(SQLException ev){}
}
高手讲解讲解,谢谢了!
//tf1.setText("hello,world");
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
}catch(ClassNotFoundException ev){}
try{
con=DriverManager.getConnection("jdbc:odbc:demo","test","123");
sql=con.createStatement();
rt=sql.executeUpdate("INSERT INTO biao VALUES('12345','cen',89,89)");//这句好像不执行
con.commit();
con.close();
}catch(SQLException ev){}
}
高手讲解讲解,谢谢了!
把那个catch(SQLException ev){}
改成:
catch(SQLException ev){ev.printStackTrace();}
注意: .newInstance();不行的话,告知,再找问题。
这句你在数据库可以执行吗?