473,466 Members | 1,336 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

How to resolve NoResultSet-Produce problem in JAVA?

Gobindap
25 New Member
Whenever I try either to insert new record of update existing record in the database it produces NoResultSet-Produce error but it makes effect in database. How to resolve this problem. The code I have used is as below:
Expand|Select|Wrap|Line Numbers
  1. try {
  2.         Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
  3.         con = DriverManager.getConnection("jdbc:odbc:MarksheetDB", " ", "222222");
  4.     Statement st = con.createStatement();
  5.     String sql="update valueTable set field1='value1', field2='value2' where ID = 1";
  6. ResultSet rs = st.executeQuery(sql); 
  7.     } catch (Exception e) {
  8.        JOptionPane.showMessageDialog(null, e);
  9.     }
Apr 8 '13 #1

✓ answered by r035198x

Do not use executeQuery to run insert and update statements. Only use it for selects. Use executeUpdate instead.

1 1176
r035198x
13,262 MVP
Do not use executeQuery to run insert and update statements. Only use it for selects. Use executeUpdate instead.
Apr 8 '13 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Francis M | last post by:
Nowadays when you obtain the SDK form java.com you get a new interactive programming environemt much like the Borland C++ IDE. Up to now I've been developing applications "the old way" using...
4
by: Lorenzo | last post by:
hi you all, first of all apologies for having cross-posted this message but really i did not know where to post it. please let me know what ng you consider the most suitable for the described...
4
by: Abdelhalim MIMOUNI | last post by:
hi, i'm new to java, and using sun last JDK, and i'm trying to understand how work this feature when we want to compile at command line ? i'm trying to set the classpath to the directory of the...
8
by: Digital Puer | last post by:
I made the following table to help me (re)learn inheritence basics. Can someone check if it's correct? This table requires a courier-like font. Java C++ ---- ...
1
by: Tony Johansson | last post by:
Hello! I get compile error when compiling using the command javac from the command terminal window(CMD). I have just two classes which are called HelloWorld.java and Slask.java. I have both...
1
by: vsp15584 | last post by:
Hii..i use the coding as below :- import java.applet.applet; import java.awt.*; import com.sun.j3d.utils.applet.mainframe; import com.sun.j3d.utils.universe.*; import...
3
by: toish | last post by:
I have a program, aaa.java which creates an instance of another class(bbb.java). both java files are in a package entitled 'diss' bbb.java compiles sucessfully aaa.java throws a cannot resolve...
0
oll3i
by: oll3i | last post by:
when running the command i get the following error :( java HelloClient -ORBInitialPort 1050 ERROR : org.omg.CosNaming.NamingContextPackage.NotFound: IDL:omg.org/CosNaming/N...
2
by: inetjack | last post by:
Hi, This is a little test application, generating and compiling code at runtime. The loadClassLoader() method of the Factory Object suppose to unload all class previously loaded. It does not...
3
by: Sindhu Rani | last post by:
i hav created 3 classes in 3 different files. am gettin an error durin compilation. wat shud i do??? C:\s\source>javac -d ..\classes devtestdrive.java devtestdrive.java:5: cannot resolve symbol...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.