Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 4 of 4

Thread: resultset

  1. #1
    Junior Member
    Join Date
    Feb 2013
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default resultset

    Hello everybody,

    i'm new in databaseprogramming. I have a question about pulling things from a database.
    for example i've got a few textfields wich i fill with data from a database through a resultset.
    I also have a combobox where i want to pul data from another table in the database.

    Do i have to make seperated statements and resultsets?? or can i use one statement and one resultset with different query''s

    kind regards,


  2. #2
    Super Moderator curmudgeon's Avatar
    Join Date
    Aug 2012
    Posts
    1,130
    My Mood
    Cynical
    Thanks
    64
    Thanked 140 Times in 135 Posts

    Default Re: resultset

    How can you have one ResultSet from different queries? A query will generate a ResultSet, and so I'm confused by your statement.

  3. #3
    Junior Member
    Join Date
    Feb 2013
    Posts
    9
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: resultset

    Quote Originally Posted by curmudgeon View Post
    How can you have one ResultSet from different queries? A query will generate a ResultSet, and so I'm confused by your statement.
    Statement stmt = con.createStatement()
    Resultset rs = stmt.executeQuery("Select * from tblXXX")

    Must the Statement stmt for a different query also separated declared?

  4. #4
    Super Moderator curmudgeon's Avatar
    Join Date
    Aug 2012
    Posts
    1,130
    My Mood
    Cynical
    Thanks
    64
    Thanked 140 Times in 135 Posts

    Default Re: resultset

    Quote Originally Posted by takamine View Post
    Statement stmt = con.createStatement()
    Resultset rs = stmt.executeQuery("Select * from tblXXX")

    Must the Statement stmt for a different query also separated declared?
    I believe that you can use the same Statement, I think as long as you don't close it or the connection. What happens if you try this?

Similar Threads

  1. Best Database with a scrollable resultSet
    By Jeff.Steinkamp in forum JDBC & Databases
    Replies: 2
    Last Post: January 21st, 2013, 06:56 AM
  2. Required help about the resultset.last()
    By derick_ho in forum JDBC & Databases
    Replies: 1
    Last Post: July 16th, 2012, 09:21 AM
  3. Resultset for relate table
    By whiga in forum JDBC & Databases
    Replies: 1
    Last Post: May 16th, 2011, 01:04 PM
  4. ResultSet issues
    By _lithium_ in forum JDBC & Databases
    Replies: 3
    Last Post: March 4th, 2011, 03:20 PM
  5. ResultSet is Closed
    By ramayya4u in forum JavaServer Pages: JSP & JSTL
    Replies: 1
    Last Post: May 24th, 2009, 03:54 AM