• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Junilu Lacar
  • Martin Vashko
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Scott Selikoff
  • salvin francis
  • Piet Souris

inserting values in database....

 
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi ,
i got stucked with sql-servlet combination...
i have worked comfortably with select statements..
i tried one insert statement and i got the problem
rs=st.executeQuery("insert into Result (Name,Roll_no) values('"+req.getParameter("name")+"','"+req.getParameter("roll_no")+"');");

this is the actual statement and it inserts values in database
also but throws an exception..
java.sql.SQLException: No ResultSet was produced
what do i do so that i won't get the exception?
also if i just want to check that if some value is there in
database or not e.g. user name and poassword, which sql
statement should i use?
Thanx for ur helping hand...
bhupendra
 
Ranch Hand
Posts: 297
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The insert statement does not create a result set, unlike a select statement. I think you may want to use the executeUpdate() methoed rather than the executeQuery() method. executeUpdate() will return an int representing the number of rows affected.
 
I've never won anything before. Not even a tiny ad:
Java file APIs (DOC, XLS, PDF, and many more)
https://products.aspose.com/total/java
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!