I've just found a problem with the LastChanged/timestamp field when updating. Currently the generated code adds an output parameter named 'new_LastChanged' to retrieve an updated timestamp field like this:
cm.Parameters.AddWithValue(
"@new_LastChanged", mLastChanged)This value is then read back with this:
mLastChanged =
CType(cm.Parameters("@new_LastChanged").Value, Byte())For some reason, the returned value is only 1 byte, not 8. I tested this with a varchar parameter using similar code and got the same behaviour - the return value was always trancated to one character. I assume the problem is associated with the way AddWithValue initializes space for the return value.
In Rocky's Project Tracker sample he uses this to add the parameter:
Dim param As New SqlParameter("@newLastChanged", SqlDbType.Timestamp)Anyway, I am currently working around this by adding the following code after the parameter is added:
cm.Parameters(
"@new_LastChanged").SqlDbType = SqlDbType.TimestampI actually do this in the user class so my generated partial class remains untouched. Can this line be added to the generated code?
It's probably obvious, but I thought I should add that this also occurs when inserting a new record.
Unfortunately I’m using VB, so I guess I'll have to wait. But thanks anyway.
Copyright (c) Marimer LLC