i am geting error when i try to use following,why is it so?
ResultSet findByUsername(String tablename,String field,String value)
{
pStmt = cn.prepareStatement("SELECT * FROM" + tablename +" WHERE ? = ? ");
pStmt.setString(1,field);
pStmt.setString(2,value);
return(pStmt.executeQuery());
}
also i tried following , but its not working too
ResultSet findByUsername(String tablename,String field,String value)
{
String sqlQueryString = " SELECT * FROM " + tablename +" WHERE " + field + "= ? ")
pStmt =cn.prepareStatement(sqlQuery);
pStmt.setString(1, value);
return(pStmt.executeQuery());
}