'Display data in text boxes by clicking into DataGridview to update or save the data C# with MySql db
I want to display the data into the text boxes to update the data(is this because of the DateTimePicker?. This is my code.
private void btnUpdate_Click
cmd = new MySqlCommand("UDPATE tbl_members SET .......", con);
cmd.Parameters.AddWithValue("@memberid", memberid);
cmd.Parameters.AddWithValue("Birthdate", dtpBDate.Text);
cmd.Parameters.AddWithValue("@DateofMembership", dtpMembership.Text);
cmd.ExecuteNonQuery();
MessageBox.Show("Record Updated Successfully");
con.Close();
DisplayData();
ClearData();
private void dgv_Member_RowHeadMouseClick
memberid = Convert.ToInt32(dgv_Member.Rows[e.RowIndex].Cells[0].Value.ToString());
dtpBDate.Text = dgv_Member.Rows[e.RowIndex].Cells[12].Value.ToString();
dtpMembership.Text = dgv_Member.Rows[e.RowIndex].Cells[22].Value.ToString();
But I got this error "String was not recognized as a valid DateTime"
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
