Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6785177
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T17:05:43+00:00 2026-05-26T17:05:43+00:00

I want to create a login system with a MS Access database. the data

  • 0

I want to create a login system with a MS Access database. the data to log in is in the database.

There is a possibility of working online, you then fill in the login details. And press OK to move to the next screen.

And an ability to work offline, then you put “student” at username (leave password empty) and press OK to move to the next screen.

There must be an error given if the credentials are wrong but there should be no error when only “student” is filled

Now the problem is it gives the error as a “student” is entered here, but he should not error to give. Only when the login data is wrong. How do I fix this?

Code:

/**Local*/
    try {
         String idnr = GebruikersnaamTekst.getText().trim();
         if (idnr.matches("Cursist")) {
        BasisScherm b = new BasisScherm();
            b.setVisible(true);
            setVisible(false);   
        }
    } catch (Exception e) {
    }

/**Internet*/
  try

   {

    String driver = "sun.jdbc.odbc.JdbcOdbcDriver";
    Class.forName(driver);

    String db = "jdbc:odbc:db1";
    con = DriverManager.getConnection(db);
    st = con.createStatement();

    }
    catch(Exception e)
    {

  }

   try
        {

        String idnr = GebruikersnaamTekst.getText().trim();
        String pass = Password.getText().trim();

        String sql = "select idnr,pass from Table1 where idnr='"+idnr+"'and pass='"+pass+"'";
        rs = st.executeQuery(sql);

           int count = 0;
        while(rs.next())
        {
            count = count + 1;
        }

          if (count == 1) {
        BasisScherm b = new BasisScherm();
            b.setVisible(true);
            setVisible(false);   
        }

        else 
        {
            JOptionPane.showMessageDialog(null, "Gebruiker niet gevonden!");
        }

        }
        catch(Exception ex )
        { 
        }




}  
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T17:05:44+00:00Added an answer on May 26, 2026 at 5:05 pm

    You’re looking for it to succeed if you match correctly for “Student” right?

    It might be an issue of case sensitivity, try this.

    if (idnr.toLowerCase().matches("cursist"))
    

    That will evaluate true, and be case insensitive.

    Also as far as program flow goes, if those are in the same class, or main() function, it will execute the Internet regardless of the local outcome, which could also introduce errors.

    Create a global Boolean variable perhaps. To confirm that you’ve done the student check/
    Full code:

    /**Local*/
    boolean isStudent = false;
        try {
             String idnr = GebruikersnaamTekst.getText().trim();
             if (idnr.matches("Cursist")) {
            BasisScherm b = new BasisScherm();
                b.setVisible(true);
                setVisible(false);   
                isStudent=true;
            }
        } catch (Exception e) {
        }
    if(!isStudent)
    {
    /**Internet*/
      try
    
       {
    
        String driver = "sun.jdbc.odbc.JdbcOdbcDriver";
        Class.forName(driver);
    
        String db = "jdbc:odbc:db1";
        con = DriverManager.getConnection(db);
        st = con.createStatement();
    
        }
        catch(Exception e)
        {
    
      }
    
       try
            {
    
            String idnr = GebruikersnaamTekst.getText().trim();
            String pass = Password.getText().trim();
    
            String sql = "select idnr,pass from Table1 where idnr='"+idnr+"'and pass='"+pass+"'";
            rs = st.executeQuery(sql);
    
               int count = 0;
            while(rs.next())
            {
                count = count + 1;
            }
    
              if (count == 1) {
            BasisScherm b = new BasisScherm();
                b.setVisible(true);
                setVisible(false);   
            }
    
            else 
            {
                JOptionPane.showMessageDialog(null, "Gebruiker niet gevonden!");
            }
    
            }
            catch(Exception ex )
            { 
            }
    
    }  }//end if
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to create a login system in Rails 3 where I can access
I want to create a login system using aspnet_regsql.exe After the aspnet_regsql.exe installiation in
i want to create a OpenId login system like stackoverflow :) in drupal..By default,
I am trying create system in which I can login from php and then
I'm creating a login system and want to block the person trying to log
I want to create a simple (non-secure) login-check from mysql database, where I have
I want to create a log in system using htaccess and htpasswd file and
Hi I want to create a WCF service that have login method, which is
I'm creating a login page. I want to create ASP.NET TextBox controls that have
I am trying to create a login system with Zend that when a user

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.