There is a way to change the content of an 'if' statement depending the condition of that it was activated?

Hi! I have a group of collider objects in my project that ‘pop up’ a message when the player touch them (using OnTriggerEnter). The messages are taken from a SQLite database. The messages are classified by categories and each collider object activates a specific type of message. I’m thinking on ‘activate’ each message using a different sets of bools with a ‘if’ statement, but if I need to copy all the query inside every ‘if’, including the readers and other stuff, the code is going to be excessively long, because I have 15 categories, so, 15 if statements. This is the code:

private void Insert()
        using (IDbConnection dbconn = new SqliteConnection(conn))

            using (IDbCommand dbcmd = dbconn.CreateCommand())
                if (mastin== true)
                    string sqlQuery = "SELECT * FROM Animals WHERE Breed= 'Mastin'";
                    dbcmd.CommandText = sqlQuery;
                    using (IDataReader reader = dbcmd.ExecuteReader())
                        while (reader.Read())
                            int id = reader.GetInt32(0);
                            string category= reader.GetString(1);
                            string dialog= reader.GetString(2);
                            string A = reader.GetString(3);
                            string B = reader.GetString(4);
                            string C = reader.GetString(5);
                            string D = reader.GetString(6);

                            DogText.text = dialog;
                            AnswerAText.text = A;
                            AnswerBText.text = B;
                            AnswerCText.text = C;
                            AnswerDText.text = D;






My Question is: there is some way to manipulate the ‘if’ without be obligated to make a lot of them and copy the contents of it again and again. I mean, something that changes the query depending of what condition of ‘if’ has been activated. eg. If the statement was activated by the bool “dog”, a proper word of the query changes to “dog” too. Something like that exists? Thanks in advance.

The problem isn’t with “if” statements, it is with reliance on bools for multiple states like this. The example you’ve posted thus far suggests you’re choosing between 15 breeds of dogs, but your commentary suggests there could be other categories. What is required, for the former, is a single value representing an enumeration or integer which can be used as an index from an array of strings to form the query. For example, if 0 were mastin, 1 were poodle and 2 were doberman, something like:

    string s1 = "SELECT * FROM Animals WHERE Breed='";
    string s2 = "'";
    string[] dogs = { "mastin", "poodle", "doberman" };

    int n = 1;

   string query = s1 + dogs[n] + s2;

This would fashion the query for a poodle. Adjust to your needs.