- Arjun Sankar
- PowerBuilder
- Wednesday, 21 August 2024 08:22 AM UTC
Hello,
We upgraded our applications from PowerBuilder 2017 R3 to 2022 R3 recently. We are facing a strange issue related to a datawindow update. The dw.update() fails with an error message as 'Conversion failed when converting date and/or time from character string'. We are using MS SQL Server 2019 as backend database and using SQL Native Client 11.0 as the DB driver.
The issue is coming from a 'datetime' field. The data type of this field is 'datetime' in both PowerBuilder datawindow and the DB table column. However, when we insert a row into this data window and call the dw.update function to save the new row into the database, we are seeing the datetime value as '2024-08-21 04:06:38.723333'. If you notice, the last 3 digits in the timestamp '333' is 'somehow' getting added (ideally it should have been 04:06:38.723) and the DB is rejecting this as it is unable to convert this into a valid 'datetime' field. Looks like the precision is changing to datetime2 instead of datetime - I could be wrong with this assumption.
We checked this in PowerBuilder 2017 R3 and everything works fine there. Please advice any solutions/ workarounds for this issue.
Find Questions by Tag
Helpful?
If a reply or comment is helpful for you, please don’t hesitate to click the Helpful button. This action is further confirmation of their invaluable contribution to the Appeon Community.