Page 1 of 1

Set the DataSize of a field

Posted: 11.04.2006, 10:51
by PiSymbol
Dear visitors,

I'm trying to receive data from a MS-SQL database. The problem is in the size of the data. The datasize is set to 256 while the data contains more than 256 characters. How do I set the 'DataSize' of a field to 1000?

You can receive the datasize of a field using this source:

Code: Select all

ShowMessage(ZQuery1->Fields->FieldByNumber(i)->DataSize);
Thanks in advance

Posted: 11.04.2006, 11:20
by zippo
Use the BLOB type

Posted: 12.04.2006, 11:26
by btrewern
I think Delphi/BCB has a limit of 255 for String type fields. For anything more than that you have to use Memo fields. I'm not sure of the mapping between strings in MSSql and Delphi field types.

Ben

Posted: 12.04.2006, 21:00
by PiSymbol
Applications like SQLExecMS don't have any problems receiving fields containing more than 256 characters.

It's not a solution to use Memo fields or BLOB fields, because the data is added by someone else and he's using other software.

Posted: 13.04.2006, 09:17
by zippo
You have to define the memo/blob in your application. The problem is that your app is trying to read a 255 string instead a large memo. You have to define the fieldtype in the TDataset as memo or something like this (blob,... etc.) I'm not a MsSQL expert, so the datatype may vary on the server type.