Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2004
    Posts
    7

    Unanswered: new to JDBC question

    I have an application where i add a new row to the data base,
    then I want to select another attirbute for the person i have just entered to the db, i.e if they pay monthly or annually,
    I have tried moving the result set 'backwards' but i get a null pointer

    so basically i add a new member to my database, and then want to change some data in this new row, how do i get back to the row?

    one way i was thinking was to get the ID of the member i had to just added and then search using the ID to get the right row, but there is no result set returned from a insert query?
    can anyone point me in the right direction?
    cheers
    D

  2. #2
    Join Date
    Feb 2004
    Posts
    18
    Why would you want to insert a row, then update the same row based on some criteria. I suggest you identify whatever data it is that you want to enter first and then write a simple insert query.

  3. #3
    Join Date
    Dec 2003
    Posts
    454
    What is the database you are using? If it is MS SQL, you can do the following way:

    INSERT INTO TableName(col1, col2, ..., coln) VALUES(val1, val2, ..., valn)

    SELECT @@IDENTITY AS 'newRowID'

    and then you can update that row.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •