Error :"Invalid Cursor State"

Joined
Jun 29, 2011
Messages
1
Reaction score
0
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();
}
}
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top