Solved

mysql insert statement format

Posted on 2004-04-07
2
289 Views
Last Modified: 2010-04-01
how do you enter these fields into a table called 'register' in mysql using jsp.
strUsername
strPassword
this is what i am trying
ResultSet rs1 = stmt.executeQuery("insert into register(userName, password, fName, lName, dept, phone_no, email, budget) values ('strUserName','strPassword','strFirstName','strLastName','strDept','strPhone','strEmail','strBudget')");
             
0
Comment
Question by:Raftor
2 Comments
 
LVL 9

Accepted Solution

by:
Nick_72 earned 50 total points
ID: 10773619
Your statement looks ok, but there are two things:

when you insert or modify rows in a table you have to use stmt.executeUpdate() instead of executeQuery()

secondly, executeUpdate() returns an int with the number of rows affected instead of a ResultSet.

/Nick
0
 

Author Comment

by:Raftor
ID: 10773637
Cheers Nick!
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Problem with Pie chart in Jsp 20 223
spring AOP 6 88
maven webservice example issue 2 144
eclipse buid path vs tomcat lib path 10 34
The business world is becoming increasingly integrated with tech. It’s not just for a select few anymore — but what about if you have a small business? It may be easier than you think to integrate technology into your small business, and it’s likely…
In threads here at EE, each comment has a unique Identifier (ID). It is easy to get the full path for an ID via the right-click context menu. However, we often want to post a short link within a thread rather than the full link. This article shows a…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

821 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