Question: In this program I try to get data from SQL into a list of strings and show them in a `messageBox`. The program should start searching when I type one character in `textBox` and use this in the query as below: 

```
string sql = " SELECT * FROM general WHERE element='" + textBox1.Text + "'  OR element='" + textBox2.Text + "' OR element='" + textBox3.Text + "' OR element='" + textBox4.Text + "'";

        MySqlConnection con = new MySqlConnection("host=localhost;user=mate;password=1234;database=element_database");
        MySqlCommand cmd = new MySqlCommand(sql, con);
        con.Open();

        MySqlDataReader reader = cmd.ExecuteReader();
        string rd;
        rd = reader.ToString();

        int i=0;
        List<string>  item = new List<string>();

        while (reader.Read())
        {
            item.Add(rd["element"].ToString());//i got error in this line

        }

        for (i = 0; i < item.Count;i++ )
        {
            MessageBox.Show(item[i]);

        }

```

What am I doing wrong?

Answer: 
What are you doing wrong? a bunch of things:

In your question you write you gen an error but don't tell us what it is.  

Exceptions has messages for a reason: so that you will be able to know what went wrong.

As to your code:

* You are concatenating values into your select statement instead of using [parameterized queries.](https://msdn.microsoft.com/en-us/library/vstudio/bb738521(v=vs.100).aspx) This creates an opening for [sql injection attacks.](https://xkcd.com/327/)
* You are using an `SqlConnection` outside of a `using` statement.  

You should always use the `using` statement when dealing with `IDisposable` objects.
* You assume that `rd["element"]` always have a value.  

If it returns as `null` from the database, you will get a null reference exception when using .ToString() on it. The proper way is to put it's value into a local variable and check if this variable is not null before using the `.ToString()` method.
* You are using `rd` instead of `reader` in your code. the `rd` variable is meaningless, as it only contain the string representation of `MySqlDataReader` object.
You have declared `rd` as string. You probably meant to use the reader object in this loop instead:

```
while (reader.Read())
    {
        item.Add(reader["element"].ToString());// change "rd" to "reader"
    }

```