C# DateTime to MySqlDateTime convert
Posted by: Yuriy Osipov
Date: June 24, 2013 08:35AM

Im using MySQL connector to receive data form database and put values to dataset->dataGridView. Then i need to change value in date column when i click on column with checkbox:

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");
}
}
I need to convert DateTime to MySqlDateTime, to insert value in some column. Now i have error, that expects MySqlData type. Unable to convert System.DateTime value to MySQL date/time

Options: ReplyQuote


Subject
Written By
Posted
C# DateTime to MySqlDateTime convert
June 24, 2013 08:35AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.