我的java程序的代码片段如下所示
String IQuery = "select customername, address from `customeraccount` where emailaddress=? and password=?";
System.out.println("Connecting to a selected database...");
// STEP 3: Open a connection
conn = DriverManager.getConnection(DB_URL, USER, PASS);
System.out.println("Connected database successfully...");
PreparedStatement stmt = conn.prepareStatement(IQuery);
stmt.setString(1, username);
stmt.setString(2,pwd);
ResultSet rs = stmt.executeQuery();
while(rs.next()){
detailName.setText(rs.getString("customername"));
detailAddress.setText(rs.getString("address"));
}
在上面的代码片段中,我能够从customeraccount表中获取数据并将其显示在jframe接口上。但是当我检查eclipse控制台时,会出现带有标题消息的错误。
答案 0 :(得分:0)
我试图在稍后的声明中再次执行查询。来自我身边的诚实错误。一个良好的夜晚睡眠可以刷新你看到的大脑