Solved

Error is 'Statement::executeQuery This statement did not return a result set" even though I was not expecting a RS

Posted on 2006-10-24
6
1,345 Views
Last Modified: 2008-01-09
This is the query: StringBuffer sbQuery = new StringBuffer("");
            sbQuery.append("INSERT INTO ");
            sbQuery.append("inv_grp ");
            sbQuery.append("(inv_grp.assoc_cd, ");
            sbQuery.append("inv_grp.clb_cd,  ");            
            sbQuery.append("inv_grp.inv_grp_name, ");      
            sbQuery.append("inv_grp.inv_grp_desc, ");      
            sbQuery.append("inv_grp.inv_grp_disc, ");      
            sbQuery.append("inv_grp.status, ");      
            sbQuery.append("inv_grp.gl_account)  ");
            sbQuery.append("VALUES (?, ");
            sbQuery.append("?,  ");            
            sbQuery.append("?,   ");
            sbQuery.append("?,   ");
            sbQuery.append("?,   ");
            sbQuery.append("?,   ");
            sbQuery.append("?)   ");
            SQL sql = new SQL();
            
            try{
                        dbConn = sql.getConnectionObj();       
                        pStmt = dbConn.prepareStatement(sbQuery.toString());
                        pStmt.setString(1, UserAssocCd2);
                        pStmt.setString(2, UserClbCd2);
                        pStmt.setString(3, GroupName);                        
                        pStmt.setString(4, GroupDesc);
                        pStmt.setString(5, Discount);
                        pStmt.setString(6, Status);
                        pStmt.setString(7, GlAccount);
                        pStmt.executeQuery();
                  }

Here, the DB was updated with the input parameter values. As you can see I am trying to collect a result set. However, the error is saying that the statement did not return a result set. Thanks a lot  for your help.
0
Comment
Question by:jdharsha
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 

Author Comment

by:jdharsha
ID: 17796237
Modification: I am not trying to collect a RS. Thanks.
0
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 17796418
pStmt.executeQuery();

should be

pStmt.executeNonQuery();
0
 

Author Comment

by:jdharsha
ID: 17797114

it seems that pStmt does not have a method pStmt.executeNonQuery(). Are you sure that it is a valid method, because I cant see it in Pstmt methods.
The problem, I guess, stems from the fact that the method executeQuery returns a resultSet. I just want to do an insert and dont need a result set. is there any method that i can use for this task. Thanks for your help.
0
 

Author Comment

by:jdharsha
ID: 17797145
I need to use executeUpdate instead of executeQuery. thats it. Thanks a lot anyways, for your time. I really appreciate it
0
 
LVL 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 125 total points
ID: 17797545
looks like you are using java and not .net ...
http://msdn2.microsoft.com/en-us/library/ms378190.aspx

the member would hence be
pStmt.executeUpdate();
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

The Delta outage: 650 cancelled flights, more than 1200 delayed flights, thousands of frustrated customers, tens of millions of dollars in damages – plus untold reputational damage to one of the world’s most trusted airlines. All due to a catastroph…
I have a large data set and a SSIS package. How can I load this file in multi threading?
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.
Via a live example, show how to shrink a transaction log file down to a reasonable size.

733 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question