Truncated String Error in Grid

Discussion of open issues, suggestions and bugs regarding SDAC (SQL Server Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
Randy3W
Posts: 12
Joined: Sat 15 Jan 2011 14:59

Truncated String Error in Grid

Post by Randy3W » Sat 15 Jan 2011 16:27

When Editing data in a grid, I get an error "String of Binary data would be truncated" when I enter a string containing the the same number of characters as the string width.

CREATE TABLE TestTypes(
[ID] [int] IDENTITY(1,1) NOT NULL,
[vChar_5] [varchar](5) NULL,
[Char_5] [char](5) NULL,
[NVChar_5] [nvarchar](5) NULL,
[NChar_5] [nchar](5) NULL
)

Using a TMSQuery with the query: "Select * from TestTypes".
Attached this to a TMSDataSource and the result to a TDBGrid.

The grid populates fine.
Entering '1234' into VChar_5 or Char_5 updates the table just fine.

Entering '12345' into VChar_5 or Char_5 results in the above error.
There is no problem with updates to NVChar_5 or NChar_5.


The SQL statement "UPDATE TestTypes SET cHAR_5='12345' where ID=3" works fine in SQL Mgmt Console

I'm pretty much using the default values on my TMSQuery and TMSDataSource

It's almost like the Grid is adding an extra character (perhaps a null char) before doing the post.

How can I get the updates to work properly with non-unicode data types?

Using SDAC 4.70.0.43 on Delphi 2009

AndreyZ

Post by AndreyZ » Mon 17 Jan 2011 12:16

Hello,

We have already fixed this issue. This fix is available starting with version 4.70.0.45. Please upgrade SDAC to get this fix.

Randy3W
Posts: 12
Joined: Sat 15 Jan 2011 14:59

Post by Randy3W » Mon 17 Jan 2011 18:50

Thanks! The update fixed it.

AndreyZ

Post by AndreyZ » Tue 18 Jan 2011 07:10

Feel free to contact us if you have any further questions about SDAC.

Post Reply