i connect mysql using c# and show database in datagridview
I want when i click the row in datagridview, textbox, combobox , datetimepicker will show form datagirdview
But mysql datetime : yyyy/mm/dd 00:00:00 ( 00:00:00 will default if don't write)
Datagridview : mm/dd/yyyy

i used code: datetimepicker1.DataBindings.Add("text", dataGridView1.DataSource, "Birthday");
and it appear errow. i don't know how to fix

Hello Nguyen_4:
What is the error message that you're getting? Also can you list the code you've created?


Ok, Let's assume the following table:


And the following code in your Form1 class:

        SqlConnection sqlCon;
        SqlCommand sqlCmd;
        String conString = "Server=SOLVOTERRA-HP;Database=Birthdays;
            Integrated Security=true";

        DataTable dTable;

        //DGV Cell Content Clicked Event
        private void dataGridView1_CellContentClick(object sender, 
            DataGridViewCellEventArgs e)

            //Clear Previous Binding

            //Reset New Binding
                dataGridView1.DataSource, "Birthday");


        public Form1()

            //Create New Connection
            sqlCon = new SqlConnection(conString);

            //Create New Command
            sqlCmd = new SqlCommand("SELECT * FROM Person", sqlCon);

            //Create New Data Adapter
            SqlDataAdapter sqlDataAdapter = new SqlDataAdapter(sqlCmd);

            dTable = new DataTable();
            dTable.TableName = "Results";

            //Fill The Table With Your Data

            //Close The Connection

            //Set The DGV's Data Source To The Table
            dataGridView1.DataSource = dTable;


Even though the date time stap formats don't match this wont raise an exception, in fact clicking on the row will update the DTP's value:


As the DTV is bound to the DGV, updating the DTP's value will also update the DGV. Though this wont effect your database directly.


Oh shucks... I just saw MySQL... Sorry. Ok, so you can ignore the data acquisition part, however the binding between your DGV and DTP will still be the same.