Try putting a semi-colon (;) between the 2 SQL statements.
The Statement should look like :

UPDATE dsnuser set balance= ..............        ;  Update dsnuser set
balance= .................

If that does not work, check to see what is the Delimiter defined in the
database.
The same query may be working in SQL Query Analyser because you might have
pressed the "Enter" key between the 2 statements - That also serves as a
statement delimiter.





                    "Miao, Franco
                    CAWS:EX"                  To:     [EMAIL PROTECTED]
                    <Franco.Miao@GEMS7.       cc:
                    GOV.BC.CA>                Subject:     pls help to check if it is 
SQL syntax
                                               error
                                         Company Name:
                    Sent by: A mailing  (for outgoing fax only)
                    list about Java     Comp
                    Server Pages        C
                    specification and
                    reference
                    <JSP-INTEREST@JAVA.
                    SUN.COM>


                    13/11/01 07:50 AM
                    Please respond to A
                    mailing list about
                    Java Server Pages
                    specification and
                    reference






I put two SQL update statement in one Smt string get error, but when I put
the same thing in SQL Squery Analyzer, it works fine no error.



String updatebalance ="Update dsnuser set balance= balance+"+tamount+" from
dsnuser where fname='"+fname+"' lname='"+lname+"'  Update dsnuser set
balance= balance-"+tamount+" from dsnuser where uname='"+tname+"' ";

// Get result code

int updateCount=SQLStatement.executeUpdate(updatebalance);
----------------------------------------------------------------------------

--------------------

javax.servlet.ServletException: Line 1: Incorrect syntax near 'lname'.

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://archives.java.sun.com/jsp-interest.html
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.jsp
 http://www.jguru.com/faq/index.jsp
 http://www.jspinsider.com





NOTICE: This communication is meant only for the addressee(s) named above and may 
contain information which is confidential and/or legally privileged. If you are not 
the named addressee(s), or the agent responsible for receiving and delivering this 
communication to the named addressee(s), this communication has been sent to you in 
error. If so, kindly notify the sender and delete the information immediately. 
Unauthorised dissemination, distribution, copying or reliance on this communication is 
prohibited and may attract criminal penalties. Thank you.

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://archives.java.sun.com/jsp-interest.html
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.jsp
 http://www.jguru.com/faq/index.jsp
 http://www.jspinsider.com

Reply via email to