Skip to Content
avatar image
Former Member

PowerBuilder Error - date time conversion from string

1.jpg2.jpg3.jpgWe are upgrading TLS 1.0 to TLS 1.2. We are using PowerBuilder 8 for our application and the database is SQL Server 2008. The driver which we are using is ODBC and it does not connect the application using TLS 1.2.

We have created DSN and by SQL NATIVE CLIENT 10 we are connecting the application using PB8. In ini file we have configured the same. We have also updated the sqlncli10.dll from version 2009.100.1617.0 to 2009.100.6542.0 in C:\windows\syswow64.

When we save records from the application we are getting the error as SQL SERVER NATIVE CLIENT Cannot convert date or time from character string. In Database the field type is date time and also when it insert records to the DB the field type is date time. But still we are getting the error.

1.jpg (94.8 kB)
2.jpg (32.7 kB)
3.jpg (13.7 kB)
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

5 Answers

  • May 14 at 01:10 PM

    Hello Suresh,

    What I could suggest is enabling the database logging (e.g. SQLCA.DBMS = "TRACE ODB") in your application. This will generate a log file, then you can compare the SQL statement produced by each driver.

    Hope this helps,

    Jacob

    Add comment
    10|10000 characters needed characters exceeded

  • May 14 at 01:15 PM

    Hi Suresh;

    Along with Jacob's suggestion ... I also suspect that PB 8 (which was EOL'ed over a decade ago) is just getting too outdated. I am pretty sure that PB v8 would have only supported SS 2000 (maybe 2005 with the higher patch levels) in its day.

    Good luck!

    Regards ... Chris

    Add comment
    10|10000 characters needed characters exceeded

  • May 14 at 02:21 PM

    Is the ordering Year, Month, Day i.e. 2018-05-14? This is an unambiguous ordering. Otherwise, you will likely need to convert or cast with an appropriate format.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    May 15 at 08:09 AM

    Hi Chris,

    we were using TLS 1.0 before and the pb version is 8 and sql server version is 2008. The date format which get stored in the DB is in format

    ‘YYYY-MM-DD HH:MM:SS.000’. I am sure in data window getitemdatetime it takes in the format ‘DD/MM/YYYY HH:MM:SS’ and during save it stores date format as YYYY-MM-DD HH:MM:SS.000’

    After TLS 1.2 update and updating sqlncli10.dll from version 2009.100.1617.0 to 2009.100.6542.0 in C:\windows\syswow64 we are getting error "Cannot convert date or time from character string.". In debug mode it takes date in the format ‘DD/MM/YYYY HH:MM:SS’ and during save it throws error.

    we also changed the language and region setting in the format YYYY-MM-DD HH:MM:SS.000’. During debug system takes the getitemdatetime in the format YYYY-MM-DD HH:MM:SS.000’ and during save it again throws the same error

    "Cannot convert date or time from character string.". In this case the date is in correct format as that of DB but still error pops up.

    Thanks,

    Suresh

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    May 15 at 08:09 AM

    Hi Jacob, Thanks

    As per your suggestion I have enabled Trace ODB and please refer the message in the trace log.

    (a4d85cc): EXECUTE:

    (a4d85cc): INSERT INTO transactions ( member_id , trans_dt , trans_dt_entered , tran_code , reason_code , tran_type , description , points , user_id , process_status , station_id , terminal_no , receipt_no , sales_report_no , sales_seq_no , approv_code , amount , quantity ) VALUES ( '15954932 ' , {ts '2018-05-15 14:14:47.188000'} , {ts '0015-01-?? 00:00:00.000000'} , 'PTSADJ' , 'PROMOTION' , 'M' , 'Points adjusted:' , 500.00 , 'sureshks' , 'REQUEST' , '000' , null , null , null , null , null , null , null ) (0 MilliSeconds)

    (a4d85cc):

    Error 241 (rc -1) : SQLSTATE = 22008

    [Microsoft][SQL Server Native Client 10.0][SQL Server]Conversion failed when converting date and/or time from character string.

    Thanks,

    Suresh

    Add comment
    10|10000 characters needed characters exceeded