我得到错误:
'字段列表'中的未知列'customerno''。
但是,该列存在于我的客户表中。那为什么我会得到这个异常?
代码:
import java.sql.*;
public class Classy {
static String myQuery =
"SELECT customerno, name" +
"FROM customers;";
public static void main(String[]args)
{
String username = "cowboy";
String password = "1234567";
try
{
Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/Business", username, password);
Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery(myQuery);
while(rs.next())
{
System.out.print(rs.getString("customerno"));
}
} catch(SQLException ex){System.out.println(ex);}
}
}