hi;
I am using SDAC 4.xx pro and my problem is TWideMemoField.savetostream and loadfromstream.
my report tool is fastreport 4 and I am saving to database (fr3 xml file)
using 3.xx trial when my field has TMemoField after upgrade to SDAC 4 fieldtype chanced to TWideMemoField.
now my data is like "?????????•???????????????4????????????????????????????????????•??......"
sorry my bad english and please help me.
...
var
ms :TMemoryStream;
begin
ms := TMemoryStream.Create;
frx.savetostream(ms); // frx is fastreport 4 (TfrxReport)
ms.Position := 0;
MSDataset1.edit;
MSDataset1WideMemoField.loadfromstream(ms);
MSDataset1.post;
....
....
end;
Thanks and Best Regards
Emre
TWideMemoField and LoadFromStream
Support of the TWideMemoField class was addeed in BDS 2006.
We have supported this functionality in SDAC 4. Now no conversion is performed when you write non-Unicode data to Unicode field.
You should change the column data type on the server (use TEXT data type instead of NTEXT), or perform conversion from ANSI strings to Unicode strings in your application.
There are several ways to perform such conversion:
1. Use TWideMemoField.AsString property to assign the value to it:
MSDataset1WideMemoField.AsString := sValue;
In such case you should convert the value from TMemoryStream into a string variable.
2. Use the following construction:
We have supported this functionality in SDAC 4. Now no conversion is performed when you write non-Unicode data to Unicode field.
You should change the column data type on the server (use TEXT data type instead of NTEXT), or perform conversion from ANSI strings to Unicode strings in your application.
There are several ways to perform such conversion:
1. Use TWideMemoField.AsString property to assign the value to it:
MSDataset1WideMemoField.AsString := sValue;
In such case you should convert the value from TMemoryStream into a string variable.
2. Use the following construction:
Code: Select all
uses
MemData...;
...
var
ms :TMemoryStream;
Blob: TBlob;
begin
ms := TMemoryStream.Create;
frx.savetostream(ms); // frx is fastreport 4 (TfrxReport)
ms.Position := 0;
MSDataset1.edit;
Blob := MSDataset1.GetBlob(MSDataset1WideMemoField);
Blob.Clear;
Blob.IsUnicode := False;
Blob.LoadFromStream(ms);
MSDataset1.post;
end;
...