0
我使用MySQL連接器來接收數據表單數據庫並將值設置爲dataset> dataGridView。然後,我需要更改日期列的值時,我與複選框,點擊列:C#DateTime到MySqlDateTime轉換
private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
if (dataGridView1.Columns[e.ColumnIndex].Name == "Продано")
{
DataGridViewCheckBoxCell checkbox = (DataGridViewCheckBoxCell)dataGridView1.CurrentCell;
bool isChecked = (bool)checkbox.EditedFormattedValue;
DateTime dt = DateTime.Today;
dataGridView1.Rows[e.RowIndex].Cells[4].Value = dt.ToString("yyyy-MM-dd");
}
}
我需要的DateTime轉換爲MySqlDateTime,在一些列中插入值。 現在我有錯誤,期望MySqlData類型。 Unable to convert System.DateTime value to MySQL date/time
哪條線導致錯誤? –