SELECT * "
+ "FROM Table1 "
+ "WHERE Username = ? "
+ "AND Password = ?;");
PreparedStatement.setString(1, "Albert");
PreparedStatement.setString(2, "123"); OR USING VARIABLES
THIS WORKS
SELECT * "
+ "FROM ? "
+ "WHERE Username = ? "
+ "AND Password = ?;");
myPreStatement.setString(1, "Table1");
myPreStatement.setString(2, "Albert");
myPreStatement.setString(3, "123"); OR USING VARIABLES
THIS DOES NOT :
java.sql.SQLException: [SQLITE_ERROR] SQL error or missing database (near "?": syntax error)
Why can I not use a ? in the FROM section. Is this not allowed or is my statement wrong in someway?
I need to use a ? in the FROM section as I have a function using this statement for multiple tables. I could just copy this function 3 times. One for each table but that seems pointless.