'Cannot display record to DataGridView in winforms

This is what my table "Item" look like in my database: enter image description here

Now, I want to display it inside my winforms application. My application include the main page that look like this: enter image description here

When I click the Store button, I expect the program will access the DataGridView inside UserControl1 that I have created and input all id, name and price from my database into it. This is how I make it inside the main view page:

string connectionString = @"myconnectionString";     
private void storeBtn_Click(object sender, EventArgs e)
    {
        
        userControl21.Hide();
        userControl11.Show();
        userControl11.BringToFront();
        using (SqlConnection sqlCon = new SqlConnection(connectionString))
        {
            sqlCon.Open();
            SqlDataAdapter sqlData = new SqlDataAdapter("SELECT * FROM \"Item\"", sqlCon);
            DataTable mytable = new DataTable();
            sqlData.Fill(mytable);

            UserControl1 uctl1 = new UserControl1();
            uctl1.storeGridView.AutoGenerateColumns = false;
            uctl1.storeGridView.DataSource = mytable;

        }
    }

I already also putting DataPropertyName inside my UserControl DataGridView the same name with the column i want to get record in my database. And when I run program, everything run and there's no bug occured, but when I click the "Store" button, nothing come out, there's no record displayed. I also try to debug step by step but still have no idea why it doesn't received any record. At this rate, I would really appreciate any help coming.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source