banner image
Sedang Dalam Perbaikan

EXECUTE QUERY SQL AND UPDATE QUERY SQL


WRITE A DIFFERENCE BETWEEN EXECUTE QUERY SQL AND UPDATE QUERY SQL METHOD?

executeQuery(sql) method
 Used for SQL SELECT queries
 Returns the ResultSET object that contains the results of the query and can be used to access the query results.

String sql = “SELECT * from sometable”;ResultSet rs =stmt.executeQuery(sql); executeUpdate(sql)method
 This method is used for executing an update statement like INSERT, UPDATE or DELETE
 Returns an integer value representing the number of rows updated

String sql = “INSERT INTO tablename ” + “(columnNames) Values (values)” ; int count = stmt.executeUpdate(sql);
EXECUTE QUERY SQL AND UPDATE QUERY SQL EXECUTE QUERY SQL AND UPDATE QUERY SQL Reviewed by MCH on April 27, 2014 Rating: 5

No comments:

Powered by Blogger.