Solved

mysql insert statement format

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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
library class in java 1 92
Set up Wildfly 10 8 396
how to exclude a file using regex 5 118
Can't access image with tomcat/html 6 97
In this article we will learn how to backup a VMware farm using Nakivo Backup & Replication. In this tutorial we will install the software on a Windows 2012 R2 Server.
Adding Computers to AD groups through an SCCM Task Sequence
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…

810 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