delphi - String Truncation on Transfer to ClientDataset -


I am using DBExpress driver from Firebird 2.1, DevArt and Delphi 2010. Some of my reports that worked with Delphi 2006 stopped working and an error message was shown which was "arithmetic exception, numerical overflow, or string truncation". My code encountered an error at this point:

  cds.Data: = dsProvider.Data;  

I found a place in my SQL statement, due to error:

  iif (ytd.hPayType <> prefix; -1 .scode, 'net') sPayType  

Tcdod is a custom (10) field. My conclusion is that the query returns the data to the dsProvider and when the dsProvider.Data cd. Data is passed, the CD component determines the width of the field that it receives. If I change "IIF" to a case statement, then I get the same error message. I have been able to work on this issue:

  CAST (iif (ytd.hPayType & lt Varchar (10) sPayType as;;> gt; -1; t.scode, 'NET')  

Since it was working in Delphi 2006 without CAST, I think That new behavior is due to an update of TClientDataset, it would be good to have a more forgiving behavior, whether it is good to accept it without complaining. Is there a way to configure LintDetset or do I need to tell the CAST on string results based on IIF and CASE statements to my users only?

I used to work a lot with firebirds in my previous job, this error occurs when you have Already have the large (length) value stored in varchar field DB and you are trying to get "string" in Delphi, try to update the value in DB to a small (length) varchar I'm not sure If it works for you, but try it.


Comments

Popular posts from this blog

c# - sqlDecimal to decimal clr stored procedure Unable to cast object of type 'System.Data.SqlTypes.SqlDecimal' to type 'System.IConvertible' -

Calling GetGUIThreadInfo from Outlook VBA -

Obfuscating Python code? -