hi Duc,
 
 I think that last id is a number 
int id = select max( id) from table_name;
then
"select * from table_name where last_id  = "+ id;
 
What r u doing in Last_insert_id()
 
 
Regards
deepak rustagi
 

-----Original Message-----
From: Duc Nguyen [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, July 24, 2002 10:36 PM
To: [EMAIL PROTECTED]
Subject: Last Auto Increment


Hi all,
When I insert a record into mysql table I want to obtain the
LastAutoIncrement ID, how do i do this in JSP.  I have tried this.
INSERT INTO formula (Formula_Code, Formula_Name) VALUES ('Test2','Test
Formula2') 
 
Select LAST_INSERT_ID();
 
If I used those two statement in one line I got the error say that I
have access violation problem.  If i used those two statements in two
separate sql then I got this error.
    Select LAST_INSERT_ID()
  : Results returned for UPDATE ONLY.

Can anyone help me out.

Thanks,

Duc




  _____  

Chat with friends online, try MSN Messenger: Click
<http://g.msn.com/1HM1ENUS/c144??PS=47575> Here
========================================================================
=== 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 

==========================================================================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