title: com.microsoft.sqlserver.jdbc.SQLServerexception:incorrect syntax near'='
body: <p>I'm getting the error in the first line i guess! Please help me out in dealing with it. I'm basically trying to execute a query through my front end </p>
  
  <pre><code>try {            
          ResultSet rs=st.executeQuery("select *from Login Username ='"+username+"' and Password  '"+password+"'");
          rs.last();
          int counter = rs.getRow();
          if (counter==1){
              JOptionPane.showMessageDialog(null,"Username and Password Correct","Username and Password Correct",JOptionPane.INFORMATION_MESSAGE);
  
              this.setVisible(false);
              new Menu().setVisible(true);
              hide();
              }else{
              jt_username.setText("");
              jp_password.setText("");
              JOptionPane.showMessageDialog(null,"Error","Username and Password Incorrect",JOptionPane.INFORMATION_MESSAGE);            
          }
      }
      catch (SQLException ex) {
          JOptionPane.showMessageDialog(null, ex);
      }
  </code></pre>