title: Why is that my java class is not reading the MS Access Database . The Application is running but login function is not working
body: <pre><code>billing.java
  </code></pre>
  
  <p>This is the billing class and i have finish coding the system's login, it perfectly running in the Frame but one i input the usernames and password the access database is not detected.</p>
  
  <p>public class billing {</p>
  
  <pre><code>    Connection con;
      Statement st;
      ResultSet rs; 
  
      JFrame f = new JFrame ("User Login");
      JLabel l = new JLabel ("Username:");
      JLabel l1 = new JLabel ("Password:");
      JTextField t = new JTextField(10);
      JTextField t1 = new JTextField(10);
      JButton b = new JButton("Login");
  
  
      public billing()
      {
          connect();
          frame();
      }   
  
      public void connect()
      {
  
          try{
  
  
          String driver = "sun.jdbc.odbc.JdbcOdbc.Driver";
          Class.forName(driver);
  
          String db = "jdbc:odbc:dbB";
          con = DriverManager.getConnection(db) ;
          st = con.createStatement();
          }
          catch(Exception ex)
          {
  
          }
      }
  
      public void frame()
      {
      f.setSize (600,400);
      f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
      f.setVisible(true);
  
      JPanel p = new JPanel();
      p.add(l);
      p.add(t);
      p.add(l1);
      p.add(t1);
      p.add(b);
  
      f.add(p);
  
  
      b.addActionListener(new ActionListener(){
  
          public void actionPerformed(ActionEvent e)
          {
          try
              {
          String user = t.getText().trim();
          String pass = t1.getText().trim();
  
          String sql ="select user,pass from Table2 where username ='"+user+" ' and password =' "+pass+" ' ";  // sql code
          rs = st.executeQuery(sql);
  
  
          }
  
          abstract 
          int count = 0;
          while(rs.next())
  
          {
          count = count +1;
          } 
  
          if (count == 1) 
          {
          JOptionPane.showMessageDialog(null, "Successfully Login");
          }
          else if (count &gt; 1)
          {
          JOptionPane.showMessageDialog(null, "Duplicate Account, Access Denied");
          }
          else 
          {
          JOptionPane.showMessageDialog(null, "User Not Found");
          }
  
  
          }
          catch (Exception ex)
          {
  
       }
  
      }
  }); 
  </code></pre>
  
  <p>}   </p>
  
  <pre><code>public static void main (String[] args){
  
          new billing();
  }
  </code></pre>
  
  <p>}</p>
  
  <p>please help ... this is very confusing and i dont know wher did i go wrong..</p>