Results 1 to 1 of 1

Thread: SQL Exception

  1. #1
    Join Date
    Dec 2002
    Posts
    2

    Unanswered: SQL Exception

    Hi,

    I'm get the following error:

    "java.sql.SQLException: [Microsoft][ODBC Driver Manager] Invalid cursor state "

    I'm using the following code:

    ________________________________________________

    Statement st = con.createStatement();
    ResultSet rs = st.executeQuery("SELECT max(userID) AS uid FROM users");
    String str_max_singer_id = "";
    while (rs.next()){
    str_max_singer_id = rs.getString("uid");
    System.out.println("this is : " + str_max_singer_id);
    }
    ________________________________________________

    but if I use this code:

    ________________________________________________

    Statement st = con.createStatement();
    ResultSet rs = st.executeQuery("SELECT max(userID) FROM users");
    String str_max_singer_id = "";
    while (rs.next()){
    str_max_singer_id = rs.getString("userID");
    System.out.println("this is : " + str_max_singer_id);
    }
    ________________________________________________

    then i get the following error:

    "java.sql.SQLException: Column not found "

    I'm using MSAccess's DataBase.

    Thanking you in advance.

    Tahir
    Last edited by tahir; 12-15-02 at 14:05.

Posting Permissions

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