C# MySQL table entry counting from user selection : <p>I tried to write a code which will count rows in MySQL , same as combobox-selected text.
For example in my MySQL database,i have a table(ogrencikayit) and in this table i have several columns.In my combobox there are 2 different selection which allows to select student class.When user select the class in combobox , label has to show count of total student in selected class.Here is my code;</p>

<pre><code>DB database = new DB();
        int kayitsayisi = -1;
        MySqlCommand cmd = new MySqlCommand("Select count(*) from ogrencikayit Where ogrsinif ="+comboBox3.Text.ToUpper()+"" , database.baglanti);
        database.baglanti.Open();
        kayitsayisi = Convert.ToInt32(cmd.ExecuteScalar());
        string kayitt = kayitsayisi.ToString();
        label24.Text = kayitt;
</code></pre>

<p>Shortly; i try to find a code that it will read the name of the class name from combobox than it will search in database that how many student belongs to that class and it will show it to the label.</p>
