static void firequery(String q)
{
try {
query=q;
Class.forName ("oracle.jdbc.OracleDriver");/*driver*/
//System.out.println("call");
con = DriverManager.getConnection(dbUrl, "system", "demo");
stmt = con.createStatement();
rs = stmt.executeQuery(query);
System.out.println("FIRE!!!!!!!!");
} //end try
catch(ClassNotFoundException e) {
}
catch(SQLException e) {
e.printStackTrace();
}}
String s = "Delete from Ticket where tno='"+jnumber1.getText()+"'";
humarr_conn.firequery(s);
if(query has deleted any 1 row)
JOptionPane.showMessageDialog(null, "Deleted successfully");
else
JOptionPane.showMessageDialog(null, "Delete operation failed");
我没有得到什么条件? 我使用Java作为FrontEnd和Oracle作为后端。
我希望像java中的mysql_rows_affected这样的函数。
希望得到快速和积极的回应。
答案 0 :(得分:2)
请改用executeUpdate(String sql)
。它返回查询更改的记录数。
请参阅javadoc:http://docs.oracle.com/javase/1.4.2/docs/api/java/sql/Statement.html