Difference between executeUpdate and executeQuery Methods



Q) What is the difference between executeUpdate and executeQuery Methods?

Rep) We must use executeQuery for executing the ‘select’ statement and executeUpdate for executing ‘non-select’ statement(CURD) etc

CURD is nothing but

C :- Create (insert—->statement)

U :- Update (update—–>statement)

R :- Read (select——->statement)

D :- Delete (delete——>statement)

for Ex: we can provide the code as shown below to perform create operation

Statement stmt=con.createStatement();

String Vsql=”insert into student values(200,’ram’,22,’ampet’);

stmt.executeUpdate(Vsql);

Share with SociBook.com

Random Posts

Post a Comment