```
private void button1_Click(object sender, EventArgs e)
       {
           try
           {
                 string MyConnection2 = "datasource = 127.0.0.1;port=3306;username = root;password =; database = test123; SslMode=None ;Convert Zero Datetime=True";
                 int txtno = int.Parse(textBox1.Text);
                 int pointX = 30;
                 int pointY = 40;
                 panel2.Controls.Clear();
                 for (int i = 0; i < txtno; i++)
                 {
                     TextBox a = new TextBox();
                     a.Text = (i + 1).ToString();
                     a.Location = new Point(pointX, pointY);
                     panel2.Controls.Add(a);
                     panel2.Show();
                     pointY += 20;
                 }
                 string Query = "select task_comment from test123.task_comment  where task_id ='" + textBox1.Text + "'";
                 MySqlConnection MyConn2 = new MySqlConnection(MyConnection2);
                 MySqlCommand MyCommand2 = new MySqlCommand(Query, MyConn2);
                 MySqlDataAdapter MyAdapter = new MySqlDataAdapter();
                 MyAdapter.SelectCommand = MyCommand2;
                 MyConn2.Close();
                 MySqlDataReader MyReader2;
                 MyConn2.Open();
                 MyReader2 = MyCommand2.ExecuteReader();
                 while (MyReader2.Read())
                 {
                       txtno = Convert.ToInt32(MyReader2["task_comment"].ToString());
                 }
                 MyConn2.Close(); //Connection closed here 
           }
           catch (Exception ex)
           {
                MessageBox.Show(ex.Message);
           }

```