
ERROR EN CONSULTA - You have an error in your SQL syntax
Publicado por Efrain (28 intervenciones) el 17/07/2015 22:00:48
ME DEVUELVE ERROR DE SINTAXIS EN MY SQL
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '? and Password = ?' at line 1
1
2
3
4
5
6
7
8
9
10
11
12
public int AutentificarUsuario(String SQL ,String Usuario , String Password )throws SQLException, InstantiationException, IllegalAccessException, ClassNotFoundException
{
int resultado = -1 ;
Class.forName(this.driverDB);
conexion = DriverManager.getConnection(urlHost + nombreDB ,usuarioDB ,passworDB);
PreparedStatement comando = conexion.prepareStatement(SQL);
comando.setString(1, Usuario);
comando.setString(2, Password);
ResultSet RS = comando.executeQuery(SQL);
if (RS.next()) {resultado= RS.getInt("ID");}
return resultado ;
}
Valora esta pregunta


0