Incorrect handling varchar in RAD 2009

Discussion of open issues, suggestions and bugs regarding SDAC (SQL Server Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
akm
Posts: 13
Joined: Mon 16 Apr 2007 01:01
Contact:

Incorrect handling varchar in RAD 2009

Post by akm » Thu 19 Feb 2009 22:34

Good day

Discovers a strange phenomenon - when you try to make a change in the varchar (1)
I get an error The statement has been terminated.String or binary data would be truncated.
Began to understand, and saw the following:

DBMonitor

SQL

UPDATE Report .. SaleTic
SET
et =?
WHERE
idSaletic =?

Params

et IN String [1] 'Y' That's right
Old_idSaletic IN integer 15037

But there is an error message

Error
The statement has been terminated.
String or binary data would be truncated.

However, SQL Profiler can see the following

SQL Profiler
exec sp_executesql N'UPDATE Report .. SaleTic
SET
et = @ P1
WHERE
FS = @ P2 AND idSaletic = @ P3 ', N' @ P1 varchar (2), @ P2 varchar (10), @ P3 int ',' Y ','6110610064', 15037

That is why it decided that it is varchar (2), has an extra space ....
Option TrimVarChar set to true or false, no effect ....

BUT
When working with fields in length to more than 1, all right ...
Here is an example

DBMonitor

UPDATE Report .. SaleTic
SET
FS =?
WHERE
FS =? AND idSaletic =?

FS IN String [10]'6110610064 '
Old_FS IN String [10]'7110610064 '
Old_idSaletic IN integer 15037

SQL Profiler

exec sp_executesql N'UPDATE Report .. SaleTic
SET
FS = @ P1
WHERE
FS = @ P2 AND idSaletic = @ P3 ', N' @ P1 varchar (10), @ P2 varchar (10), @ P3 int ',' 7110610064 ','6110610064', 15037

Yes there is one thing the field named BCO (highlighted in red) varchar (3), DBMonitore see everything correctly, but the SQL Profiler
paints as varchar (6), but still shows the debris field, ie value of field 'E', as drawn 'E and 02'

exec sp_executesql N'UPDATE Report .. SaleTic
SET
et = @ P1
WHERE
AGCOD = @ P2 AND DD = @ P3 AND BCO = @ P4 AND FS = @ P5 AND NPAS = @ P6 AND IND = @ P7 AND NPOS = @ P8 AND idSaletic = @ P9 ', N' @ P1 varchar (2) @ P2 varchar (4), @ P3 datetime, @ P4 varchar (6), @ P5 varchar (10), @ P6 varchar (14), @ P7 varchar (6), @ P8 int, @ P9 int ',' Y ',' a005 ','2009-02-18 00:00:00:000', 'E and 02','6110610064 ',' KIM / Adolf H-H ',' naxb02 ', 923,15037


Version SDAC 4.70.0.44
SQL 2005 SP3
C + + Builder 2009 Update 2

Ludek
Posts: 296
Joined: Thu 12 Oct 2006 09:34

Ludek

Post by Ludek » Fri 20 Feb 2009 07:17

Same (or similar problem) here, my tester reported also such errors after sdac update to 4.70.0.44. The 4.70.0.42 version is ok, this problem affects only newer versions.

Dimon
Devart Team
Posts: 2885
Joined: Mon 05 Mar 2007 16:32

Post by Dimon » Fri 20 Feb 2009 15:23

Thank you for information. We have reproduced this problem and fixed it. This fix will be included in the next SDAC build.

Post Reply