DateTime with RecordSet Row 2019r2

It looks like the Date type is deprecated now that 2019r2 is out.

I’m getting some code that’s breaking and I’m refactoring but I’m stuck on this:

Inventory.Supply.Add, line 21 There is more than one method with this name but this does not match any of the available signatures. row.DateColumn( "PurchasedDate" ) = Supply.PurchasedDate

The Row object does not not have a DateTimeColumn option. I refactored Supply.PurchasedDate from Date to DateTime and it breaks here.

The text of the debugger error message seems inaccurate to me… “There is more than one method with this name but this does not match any of the available signatures.” … this seems more like a type mismatch, but regardless:

This seems like a catch-22. I can leave Supply.PurchasedDate as Date and just deal with the deprecated warnings in the debugger which is really annoying. I’d like to bring my code up to the current version and I’d be surprised if Xojo forgot about date times being used in in databases.

I just don’t see any row.DateTimeColumn option in the row class. It’s clearly looking or Date and not DateTime…

Do I cast DateTime to Date for use in with row.DateColumn?

I’m not at my own computer so I can’t test this but maybe something like this will work.

row.Column("PurchasedDate").DateValue =  Supply.PurchasedDate

Supply.PurchasedDate has to be a DateTime value.

Almost, you put me on the right track but I explained this badly.

“row” in this case was an instance of DatabaseRecord - I’m adding a new record here.

DataBase record doesn’t have DateValue method but recordset does.

supply.PurchasedDate = data.Field( “PurchasedDate” ).DateTimeValue

So you CAN do assignment:

supply.PurchasedDate  = data.Field( "PurchasedDate" ).DateTimeValue

But for adding a new record, I had to this

row.Column( “PurchasedDate” ) = Supply.PurchasedDate.SQLDate - this compiles but the database will likely object…

This does work:

row.Column( "PurchasedDate" ) = Supply.PurchasedDate.SQLDate