Click here to Skip to main content
15,064,072 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:

I am working on a project - students management system. I made UIs for all the forms, wrote some codes for other functions. The function I'm working on now has to read textboxes, comboboxes and insert into phpmyadmin database's table - studentsdata and after this the function has to read that table and insert it in datagridview. I already did first step - my function can read textboxes, comboboxes and all of this can be successfully inserted in database but now I don't what to do next, how to load data into gridview. Thanks for you answers!

It is the code where data comes to database.

Don't judge for my asking, i am new and i will learn how to properly make a post :)
private void btnSave_Click(object sender, EventArgs e)
    foreach (Control obj in panel1.Controls)
        if (obj is TextBox)
            if (obj.Text == "")
                MessageBox.Show("Action cannot be performed. All fields must to be filled up.", "Something is missing", MessageBoxButtons.OK, MessageBoxIcon.Error);

    sql = "INSERT INTO `studentstable` VALUES ('" + txtName.Text + "', '" + txtLastName.Text + "', '" + comboBoxGender.Text + "', '" + comboBoxClass.Text + "')";

What I have tried:

I watched a lot of tutorials, but most of them are required libraries that I cannot use because of project's requirements. The hint my teacher gave me is that the simplest way to this would be using mysqladapter, is she right? If yes, how to start?

I don't need whole code, I need only start-up.
Updated 16-Jan-21 8:39am

1 solution

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900