Hi,
I couldn't save null to MSSQL to nullable columns of date by LLBL Pro Runtime v.3.5.12.703, adapter.
Dim lEntityToUpdate As New EntityClasses.OrderBookPoEntity(zaznam.OrderbookPoid) With {
.IsNew=False
.Comment = "something new", _
.CommentVendor = "ok", _
.RequestedDate = Nothing}
adapter.SaveEntity(lEntityToUpdate)
Above code updated any field to the new value except RequestedDate
Then I found http://www.llblgen.com/tinyforum/Messages.aspx?ThreadID=19894
Based on that I moved down the command .IsNew=False right before SaveEntity.
Updated code
Dim lEntityToUpdate As New EntityClasses.OrderBookPoEntity(zaznam.OrderbookPoid) With {
.Comment = "something new", _
.CommentVendor = "ok", _
.RequestedDate = Nothing}
lEntityToUpdate.IsNew = False
adapter.SaveEntity(lEntityToUpdate)
This code successfully updates also RequestedDate to NULL.
Question 1:
Why does it depend when IsNew=False is set? I guess it should not matter if IsNew=False is called as first command or last command right before SaveEntity
Question 2:
Why does it depend when IsNew=False is set just for fields set to Nothing? Other fields changed to any value are updated correctly, even .IsNew is the first line before any entity field change.
I feel this is strange behaviour of LLBL Pro
In your doc is an example how to "ADAPTER/Using the entity classes, Adapter/Update an entity directly in the persistent storage"
And .IsNew is also very first line in your example code, see:
' [VB.NET]
Dim customer As New CustomerEntity()
customer.CustomerID = "CHOPS"
customer.IsNew = False
customer.Phone = "(605)555-4321"
Using adapter As New DataAccessAdapter()
adapter.SaveEntity(customer)
End Using