UniDAC truncates long strings to 255 characters when inserting in batches

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
Wilson Alex
Posts: 16
Joined: Fri 13 Dec 2019 16:39

UniDAC truncates long strings to 255 characters when inserting in batches

Post by Wilson Alex » Tue 12 Oct 2021 08:36

Hi,

I am using the batch insert function introduced by UniDAC official documentation (https://www.devart.com/unidac/docs/batchops.htm), but when I insert a long string (more than 255 characters) into the Access database , The UniDAC component will truncate the string to 255 characters.

I checked the Access database field settings and confirmed that the field type is Long Text, so there is no problem with the database field settings.

If you do not use bulk inserts but insert one at a time, there will be no problem. I have tried using ADO components to perform data insertion and there is no problem.

So do I need to set anything to use the batch insert function of UniDAC components?

PS: I am using Delphi 7 + UniDAC 8.4.4 + Access 2016.

MaximG
Devart Team
Posts: 1822
Joined: Mon 06 Jul 2015 11:34

Re: UniDAC truncates long strings to 255 characters when inserting in batches

Post by MaximG » Tue 12 Oct 2021 19:47

We have created a sample project that sucessfully saves 10 strings of different length from a text file into Access. It can be downloaded at https://download.devart.com/dac/AccessBatch.zip
Could you modify the project so that the issue can be reproduced?

Wilson Alex
Posts: 16
Joined: Fri 13 Dec 2019 16:39

Re: UniDAC truncates long strings to 255 characters when inserting in batches

Post by Wilson Alex » Wed 13 Oct 2021 14:28

Thank you very much MaximG.

I rebuild the sample project you provided, but an error was reported during operation: "[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified."

I think this should be a problem with my ODBC driver, so I changed the database suffix to mdb and commented the DriverVersion option. When I run it again, it successfully inserts more than 255 characters.

Maybe I know where the problem is. The data type of the Long Text field of the Access database is ftString instead of ftMemo when I set the parameter. I will verify it when I have time.

Post Reply