How to copy the result from a Select into a DataSet ?

Discussion in 'Java' started by Pierre, Jun 24, 2007.

  1. Pierre

    Pierre Guest

    Hi,

    How to copy the result from a Select into a DataSet ?

    Thanks,

    Tintin92
     
    Pierre, Jun 24, 2007
    #1
    1. Advertising

  2. Pierre

    Guest

    On Jun 24, 12:32 pm, "Pierre" <> wrote:
    > Hi,
    >
    > How to copy the result from a Select into a DataSet ?
    >
    > Thanks,
    >
    > Tintin92


    An SQL select statement? SELECT x FROM x WHERE X AND Y?


    Ben.
     
    , Jun 24, 2007
    #2
    1. Advertising

  3. Pierre

    Lew Guest

    "Pierre" wrote:
    >> How to copy the result from a Select into a DataSet ?


    wrote:
    > An SQL select statement? SELECT x FROM x WHERE X AND Y?


    Assuming SQL via JDBC:

    <http://java.sun.com/javase/6/docs/api/java/sql/ResultSet.html>
    obtained from, say, a
    <http://java.sun.com/javase/6/docs/api/java/sql/PreparedStatement.html>

    PreparedStatement pstmt = con.prepareStatement(
    "SELECT name, salary WHERE id = ?" );
    ps.setString( 1, "1719232931" );
    ResultSet rs = ps.executeQuery();
    String name = rs.getString( "name" );
    BigDecimal salary = getBigDecimal( "salary" );

    Assuming anything other than what we've guessed, you'll have to be a lot more
    specific. What kind of "Select"? What is a "DataSet"?

    --
    Lew
     
    Lew, Jun 29, 2007
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Nedu N
    Replies:
    1
    Views:
    1,839
    Chris Taylor
    Oct 31, 2003
  2. Nedu N
    Replies:
    2
    Views:
    2,209
  3. Alex
    Replies:
    2
    Views:
    1,293
  4. Replies:
    26
    Views:
    2,181
    Roland Pibinger
    Sep 1, 2006
  5. Michael Tan
    Replies:
    32
    Views:
    1,082
    Ara.T.Howard
    Jul 21, 2005
Loading...

Share This Page