タイプ「TimeSpan」からタイプ「Date」への変換に問題があります。誰かがこの私のコードとエラーを手伝ってくれるなら:
Public Function combine(ByVal dateonly As DateTime, ByVal timeonly As DateTime)
date_Combine = DateTime.Parse(dateonly)
Time_Combine = DateTime.Parse(timeonly)
date_Combine.AddHours(Double.Parse(timeonly.Hour))
date_Combine.AddMinutes(Double.Parse(timeonly.Minute))
date_Combine.AddSeconds(Double.Parse(timeonly.Second))
Return date_Combine
End Function
For Each row As DataGridViewRow In DataGridView1.Rows
start = combine(row.Cells(1).Value, row.Cells(2).Value)
marche = combine(row.Cells(3).Value, row.Cells(4).Value)
diff = marche.Subtract(start).Hours
total += diff
Next
MessageBox.Show(total)
TextBox7.Text = total
エラー :
タイプ 'TimeSpan' からタイプ 'Date' への変換は無効です。
何が悪いのか知りたい
注意: 私のデータベースでは、DateStartTasck はこの形式 (yyyy-MM-dd) の Date(sql) 型であり、TimeStartTasck はこの形式の Time (sql) 型であり、00:00:00 です。