[英]java.sql.SQLException: Column 'nombreGarcia' not found. why?
我無法將我的數據庫與我的 Java 應用程序連接起來,我真的不知道它有什么問題,請來者幫我
try {
Connection miconexion = DriverManager.getConnection("jdbc:mysql://localhost:3306/concesionario","root","password");
// 2.PASO CREAR PASO STAMENT.
Statement miStatement = miconexion.createStatement();
//3.PASO EJECUTAR MY SQL.
ResultSet miresulset = miStatement.executeQuery("SELECT * FROM CLIENTES");
//4.PASO RECORRER EL RESULSET
while(miresulset.next()) {
System.out.println(miresulset.getString("dni" + miresulset.getString("nombre" + "" + miresulset.getString("apellido"))));
}
}catch(Exception e) {
System.out.println("NO CONECTA");
e.printStackTrace();
}
這條線
System.out.println(miresulset.getString("dni" + miresulset.getString("nombre" + "" + miresulset.getString("apellido"))));
將作為 apelido 的任何內容添加到“nombre”中。 該值恰好是“Garcia”,因此錯誤中是 nombreGarcia 的String
。 這是我所能幫助您的,而無需您提供更多信息。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.