Solved

mysql insert statement format

Posted on 2004-04-07
2
291 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
[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
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

Independent Software Vendors: 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

A Stored Procedure in Microsoft SQL Server is a powerful feature that it can be used to execute the Data Manipulation Language (DML) or Data Definition Language (DDL). Depending on business requirements, a single Stored Procedure can return differe…
Recently we ran in to an issue while running some SQL jobs where we were trying to process the cubes.  We got an error saying failure stating 'NT SERVICE\SQLSERVERAGENT does not have access to Analysis Services. So this is a way to automate that wit…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

739 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