目录

关于-java.sql.SQLException-Column-stuNo-not-found.-异常的完美解决方案

目录

关于 java.sql.SQLException: Column ‘stuNo’ not found. 异常的完美解决方案

在使用JDBC查询数据的时候抛出:

java.sql.SQLException
Column ‘stuNo’ not found.

at com.mysql.jdbc.SQLError.createSQLException( SQLError.java:957 )

at com.mysql.jdbc.SQLError.createSQLException( SQLError.java:896 )

at com.mysql.jdbc.SQLError.createSQLException( SQLError.java:885 )

at com.mysql.jdbc.SQLError.createSQLException( SQLError.java:860 )

at com.mysql.jdbc.ResultSetImpl.findColumn( ResultSetImpl.java:1076 )

at com.mysql.jdbc.ResultSetImpl.getInt( ResultSetImpl.java:2580 )

at chapter07.TestJDBC.main( TestJDBC.java:32 )

原因分析:

在从ResultSet中获取列数据的时候列名写错了。