Solved

mysql insert statement format

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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Suggested Solutions

Short answer to this question: there is no effective WiFi manager in iOS devices as seen in Windows WiFi or Macbook OSx WiFi management, but this article will try and provide some amicable solutions to better suite your needs.
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

744 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now