Hi all,
I have created a form used for entry of repair details into a table on a
MSDE database. I am using a datetimepicker for entry of the repair date. It
is set to SHORT display format and I have UP/DOWN enabled.
The only 3 references to this control in my code are:
1. in my form load event
datRepairDate.Value = Date.Today
which sets the dtp value to today's date by default, and sets the
time to 0:00:00 since I am not interested in the time part
2. in my DB write routine which assigns the dtp value to my SQL parameter
myCommand.Parameters("@date").Value = datRepairDate.Value
3. in my DB read routine which reads an existing record in for editing
datRepairDate.Value = myDataReader("date")
99% of the time this works fine. However very occasionally I am somehow
getting the current system time inserted into the table alongside the date
the user has selected.
example from last night's testing:
I create a new repair record with a date of 18/9/2004 and add it to the
table.
I go to the SQL console in the IDE and run a query to view the new record.
Date on the new record is 18/9/2004 0:00:00 as expected.
I go back to my program and load that repair record back in.
I change the date to 20/9/2004 and update the record.
I run a query to view the record again.
Date on the record is now 20/9/2004 10:45 PM with that time being the
time I updated the record
This makes no sense since NOWHERE in my code do I assign the current time to
the dtp.
It is reset to 0:00 every time the form opens, so any new record must have
0:00 as the time portion. Therefore any existing record I read in and edit
must also have 0:00 as the time portion.
The trouble is that it works 99% of the time, and I have not been able to
isolate the exact conditions that cause the above to occur.
ideas anyone ??
thanks in advance
Steve