cancel
Showing results for 
Search instead for 
Did you mean: 

PowerBuilder Error - date time conversion from string

Former Member
0 Kudos

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.

Accepted Solutions (0)

Answers (5)

Answers (5)

Former Member
0 Kudos

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

chris_keating
Advisor
Advisor
0 Kudos

This is the cause of the error

{ts '0015-01-?? 00:00:00.000000'}

You will need to debug the source of trans_dt_entered.

Former Member
0 Kudos

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

chris_keating
Advisor
Advisor
0 Kudos

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.

cpollach
Explorer
0 Kudos

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

CobyKako
Advisor
Advisor
0 Kudos

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