- 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("jdbcdbc: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();
}
}
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("jdbcdbc: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();
}
}