java - How to fix Error: Unresolved compilation problems: Syntax error on token "rs" -
can please tell me compilation error
"exception in thread "main" java.lang.error: unresolved compilation problems: syntax error on token "rs", delete token method getstring(int) undefined type string @ selecttest.main"
in below java code
//selecttest.java import java.sql.*; public class selecttest1 { public static void main(string args[])throws exception { class.forname("sun.jdbc.odbc.jdbcodbcdriver"); connection con = drivermanager.getconnection("jdbc:odbc:oradsn","system","123"); statement st = con.createstatement(); resultset rs = st.executequery("select*from student"); { while(rs.next()) { system.out.println(rs.getint(1)+" "+rs.getstring(2)+" "rs.getstring(3)); } rs.close(); st.close(); con.close(); } } }
the last rs.getstring(3) forget '+'
system.out.println(rs.getint(1)+" "+rs.getstring(2)+" " +rs.getstring(3));
Comments
Post a Comment