I have a strange problem with (just) one of my SQL Server database columns which is declared as datetime
. It is a bigger application and I am using lots of tables with datetime
columns, and all of them are set correctly (date & time) – except one.
Syntax (eg) is like:
FKMachineMeasureModulesMachineMeasureHistoryBindingSource.Current("LastTested") = Now()
The connection to SQL Server is done via datasets. So I assumed, maybe the column declaration probably was set to date
instead of datetime
but no, everywhere correct declared.
However, the statement above results in ‘2024-07-18 00:00:00.000’ in the SQL Server table.
If I update the column via SSMS by running
UPDATE [Machine_MeasureModules]
SET RLastTested = '18.07.2024 15:10'
WHERE id = 15271
it’s set correctly to 2024-07-18 15:10:00.000
.
When I debug the line and update within code, the inline variable browser shows it also correct. But on SQL Server, always without time.
I also tried for this specific column a format conversion of Now()
, but same result.
9