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 9125325
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T06:46:43+00:00 2026-06-17T06:46:43+00:00

I need my app to get a true / false statement from database &

  • 0

I need my app to get a true / false statement from database & do something with it.

In my Database i have a row called “ban” wich is TinyInt(1) for a true / false statement.

If a user types his license name & license number and clicks a button, my app wil compare the input data with specific rows in my database. So if ok = continue, if not ok, show error.

Also the true/false statement of the inserted input will then be added as a ListBox item.

Now i got that working, but actually i need my app to do something with true or false.

So what i need is to get the true or false from the inserted input, & then use it to say “if false then open new window if true show an error inside a TextBox”

Showing the errors is not a big deal, i got that working. The main thing here is using true or false to either continue or don’t.

I know it has something to do with Boolean, i just don’t know how to work with it.

Here’s what i got so far: (not the complete code but i think this will do)

Thanks!

    public partial class MainWindow : Window
{
    string ConnectionString = Properties.Settings.Default.cloudpos_beheerCS;
    public MainWindow()
    {
        InitializeComponent();
    }

    private void Button_Click_1(object sender, RoutedEventArgs e)
    {
        string Naamtxt = Naam.Text;
        string Licentietxt = Licentie.Text;

        MySqlConnection conn = new MySqlConnection(ConnectionString);
        MySqlCommand cmdDatabase = conn.CreateCommand();
        MySqlDataReader rdr;
        cmdDatabase.CommandText = "SELECT * FROM cloudposgebruikers WHERE licentie = @licentie AND naam = @naam";
        cmdDatabase.Parameters.AddWithValue("@naam", Naamtxt);
        cmdDatabase.Parameters.AddWithValue("@licentie", Licentietxt);

        try
        {
            conn.Open();
        }
        catch (Exception)
        {
            ErrorVerbinding.Content = "Er kan geen verbinding gemaakt worden met de database.";
            return;
        }

        rdr = cmdDatabase.ExecuteReader();
        int ollema = rdr.GetOrdinal("ban");
        while (rdr.Read())
            ListBox1.Items.Add(rdr.GetString(ollema));

            conn.Close();
        }

    }
  • 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-06-17T06:46:44+00:00Added an answer on June 17, 2026 at 6:46 am

    Ok i found the solution. I didn’t need to make a bool for the task, just 2 lines of code and it works. Thanks anyway guys !

            if (rdr.HasRows)
            {
                while (rdr.Read()) //Make sure this is added or it won't work.
                {
                    if (rdr.GetBoolean("ban"))
                    {
                        ErrorSuspend.Text = "Uw licentie is verlopen of geblokkeerd.                      Contacteer uw verdeler om een nieuwe licentie te bekomen.";
                        return;
                    }
    
                    else
                    {
                        Login Login = new Login();
                        this.Content = Login;
                    }
                }
            }
            else
            {
                ErrorLN.Content = "Licentie of naam incorrect.";
                return;
            }
        }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an app where I need to get the list of countries,languages etc
I have an app that I need to get the source code to update
I have created app using jQuery Mobile and need to get a Dialog box
I have an if statement in my Rails app. I need to do a
In my app I need to get mirrored and rotated copies of video files
Hi i'm making an app which need to get user's gmail account contact list
I need to make simple CRUD web app (i'll get paid for it), but
I need to get google search results to show in my android app. How
In my app i'm using TBXML parser where i need to get a value
in my app i for one of the handler i need to get a

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.