PDA

View Full Version : SQL Exception


tahir
12-15-02, 13:58
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