我想从 Street 列中的表中获取值..
我有:
Street = "SELECT strStreet FROM tblLocations WHERE" +
" strLocations='" + Location + "';";
当我后来尝试打印街道时,我刚刚发现它不起作用,只是打印为上面的字符串而不是值
这就是我所拥有的,它不断返回 street 的值为 null
Street = "SELECT strStreet FROM tblLocations WHERE" +
" strLocations='" + Location + "';";
try {
//create, execute and close the stmt
Statement stmt = c.createStatement();
ResultSet rs = stmt.executeQuery(Street);
while(rs.next()){
street = rs.getString("strAddress1");
}
System.out.println(street);
rs.close();
stmt.close();
} catch (SQLException ex) {
System.out.println("there was an issue updating");
System.out.println("SQLException: " + ex.getMessage());
System.out.println("SQLState: " + ex.getSQLState());
System.out.println("VendorError: " + ex.getErrorCode());
}