急求cannot be resolved怎么改呀?import java.sql.*;public class Ss {public static void main(String[] args) {try{Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");}catch(ClassNotFoundException e){}Connection con=DriverManager.getConnection("jdbc:odbc:
来源:学生作业帮助网 编辑:六六作业网 时间:2024/11/25 22:49:35
急求cannot be resolved怎么改呀?import java.sql.*;public class Ss {public static void main(String[] args) {try{Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");}catch(ClassNotFoundException e){}Connection con=DriverManager.getConnection("jdbc:odbc:
急求cannot be resolved怎么改呀?
import java.sql.*;
public class Ss {
public static void main(String[] args) {
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");}
catch(ClassNotFoundException e){}
Connection con=DriverManager.getConnection("jdbc:odbc:ee");
try{Statement sql=con.createStatement();}
catch(SQLException e){}
ResultSet rs=sql.executeQuery("select * from cc");
}
}
急求cannot be resolved怎么改呀?import java.sql.*;public class Ss {public static void main(String[] args) {try{Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");}catch(ClassNotFoundException e){}Connection con=DriverManager.getConnection("jdbc:odbc:
嗯.这个问题很有深度,经过我代码粘贴和MyEclipse测试,终于知道什么问题了.主要是ResultSet rs=sql.executeQuery("select * from cc");中sql没有定义,因为sql在try,catch范围内,需要把这条与句改为:
try{
Connection con=DriverManager.getConnection("jdbc:odbc:ee");
Statement sql=con.createStatement();
ResultSet rs=sql.executeQuery("select * from cc");}
catch(SQLException e){
}