Quantcast
Channel: MySQL Forums - Connector/NET and C#, Mono, .Net
Viewing all articles
Browse latest Browse all 1451

C# DateTime to MySqlDateTime convert (1 reply)

$
0
0
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

Viewing all articles
Browse latest Browse all 1451

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>