Unable to convert MySQL date/time value to System.DateTime.Couldn't store 0/0/0000 0:00:00 value?

前端 未结 1 605
野的像风
野的像风 2021-01-28 13:55
Me.TreatmentsTableAdapter.Fill(Me.UserDataSet1.treatments)

This line is producing error:

Unable to convert MySQL date/time value to Sy         


        
相关标签:
1条回答
  • 2021-01-28 14:08

    The SQL NULL Value for Date is 1900-01-01 00:00:00.000, You won't be able to insert a Date in 0000-00-00 00:00:00.000

    I've Experience it lately, my solution for that is store the NULL value and replace it when displaying in DataGridView or Etc...

    Sample:

    if DataGridView1.Rows(e.Index).Cells(10).Value.ToString = "1900-01-01 00:00:00.000" Then
    
    DataGridView1.Rows(e.Index).Cells(10).Value = ""
    
    End If
    
    0 讨论(0)
提交回复
热议问题