Hi Jenn,
1. Make sure you are getting results from the query. Try putting a boolean
check inside the while loop.
2. Try getting <rs.getString(1)> before getting value of <rs.getString(2)>,
or use <rs.getString("value")>.
3. Just a note: You don't the need ";" at the end of the SQL statements.
*Antonio*
----- Original Message -----
From: Jenn <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, November 23, 1999 6:57 AM
Subject: Help on Result sets
> Hi all,
>
> I am having trouble trying to get the code below to work because
it seems
> that the ResultSet rs gets corrupted whenever I run the statement to
> execute the SQL! The first insertion into the Temp table is executed, but
> after which the ResultSet becomes corrupted, the rs.next() becomes an
> invalid cursor state.
>
> try {
> rs=stmt.executeQuery("SELECT * FROM Temp where
CID='"+cid+"';");
> while (rs.next()){
> stmt.executeUpdate("INSERT INTO OrderItem
>
VALUES("+rs.getString(2)+","+oid+",'"+rs.getString(3)+"','"+rs.getString(4)+
> "');");
> }
> }
> catch (Exception e){error=""+e;}
>
>
> Please help on how to solve this problem
>
> Thanks in advance :)
> Jenn
>
>
___________________________________________________________________________
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the
body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources: http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html