データベースに最後に保存された日付: 6/13/2012 12:27:30 PM
私のDateTime Nowは次のとおりです:6/13/2012 01:27:57 AM
しかし、この関数を実行すると、常に「日付が手動で変更されました。有効な DateTime に設定してください」と表示されます。
しかし、DateTime Now は、データベースの日付よりも小さくありません。どうしたの?
これはコードです。修正してください。
Private lastdate As DateTime
Private Sub GetDBdate()
...
Dim ss As String
Dim sc As New SQLiteCommand
ss = "select dtime from dincome order by dtime desc limit 1"
sc = New SQLiteCommand(ss, mycon)
lastdate = CDate(sc.ExecuteScalar)
End Sub
Private Function CheckValidDate() As Boolean
Dim dtnow As DateTime = DateTime.Now
If dtnow < lastdate Then
Return False
End If
Return True
End Function
Private Sub Button_Click
If Not CheckValidDate() Then
label1.Text = "Date has been manually modified, Please Set to Valid DateTime"
Exit Sub
End If
...
...
Exit Sub