Error :"Invalid Cursor State"

Discussion in 'Java' started by dhavalthakor28691, Jun 29, 2011.

  1. dhavalthakor28691

    dhavalthakor28691

    Joined:
    Jun 29, 2011
    Messages:
    1
    Location:
    India
    M getting error Invalid cursor state
    here is my code.
    i can able to store data in database..in this part i m getting error..
    im nt able get value of usercount column
    plz help me
    thnx in advance


    //additionalInfo table has two colm 1>userCountId2>userCount
    public class TestConnection
    {
    public static Connection con=null;

    public static void main(String args[])
    {
    try
    {
    Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    con = DriverManager.getConnection("jdbc:eek:dbc:sqlserver");
    Statement stmt = con.createStatement(ResultSet.TYPE_SCROLL_SENSITIVE,ResultSet.CONCUR_UPDATABLE);
    String str = "select * from additionalInfo where userCountId=1";
    ResultSet rs = stmt.executeQuery(str);
    int count = rs.getInt("userCount");
    /*
    boolean b= true;
    while(b)
    {
    rs.getInt("userCount");
    b=rs.next();
    }
    //int count =rs.getInt(1);
    */


    }catch(Exception e)
    {
    //System.out.println(e.getMessage()+e.printStackTrace());
    e.printStackTrace();
    }
    }
     
    dhavalthakor28691, Jun 29, 2011
    #1
    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. hfk0
    Replies:
    2
    Views:
    21,748
  2. Kyle
    Replies:
    7
    Views:
    28,265
    abenm613@mail.ru
    Jan 21, 2005
  3. JavaQueries
    Replies:
    1
    Views:
    3,767
    John C. Bollinger
    Mar 1, 2005
  4. Balaji
    Replies:
    3
    Views:
    10,197
  5. guptapr
    Replies:
    0
    Views:
    2,098
    guptapr
    Aug 28, 2009
Loading...

Share This Page