1. Arjun Sankar
  2. PowerBuilder
  3. 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. 

John Fauss Accepted Answer Pending Moderation
  1. Wednesday, 21 August 2024 11:35 AM UTC
  2. PowerBuilder
  3. # 1

What are all of the values of the Transaction object (SQLCA)? Please mask any sensitive information.

Comment
There are no comments made yet.
Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Wednesday, 21 August 2024 12:36 PM UTC
  2. PowerBuilder
  3. # 2

Hi Arjun;

  The SNC DB client stopped being enhanced in the SS2012 time frame. SNC was deprecated by Microsoft in SS2016. Since SS2019 & higher, Microsoft's direction is to only support the newer MSOLEDBSQL DB client. In PB 2021 & higher, you should no longer use the SNC DB client. Instead, the newer MSOLEDBSQL db driver is the proper SS connectivity direction.

Ie:  SQLCA.DBMS = "MSO"

HTH

Regards ... Chris 

Comment
  1. David Peace (Powersoft)
  2. Wednesday, 21 August 2024 13:35 PM UTC
If you do convert to MSOleDBSql then you will need to DBPARM value to contain Provider='MSOLEDBSQL19'.

We have converted all our PB apps to the latest MSO drivers without any issues.
  1. Helpful
  1. Roland Smith
  2. Wednesday, 21 August 2024 13:44 PM UTC
  1. Helpful
There are no comments made yet.
mike S Accepted Answer Pending Moderation
  1. Wednesday, 21 August 2024 13:08 PM UTC
  2. PowerBuilder
  3. # 3

sql server 2019 datetime works with SNC in pb 2022R3 in my app.

are you using stored procedures for the updates/inserts?

 

 

Comment
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.