Hi,
I need to memorize a file XPS in a filed BLOB of sql server, and after i'll need to read from field BLOB from codeunit's function that i'll call from my web site by web service. So i have used, in my codeunit's function this sentece's code :
IF LocRecElencoFile.GET(Chiave) THEN BEGIN
LocRecElencoFile.MODIFY(TRUE);
NomeFile := LocRecElencoFile.NomeFile;
LocRecElencoFile.CALCFIELDS(Allegato);
IF NOT LocRecElencoFile.Allegato.HASVALUE THEN
EXIT;
LocRecElencoFile.Allegato.CREATEINSTREAM(IStream);
MemoryStream := MemoryStream.MemoryStream();
COPYSTREAM(MemoryStream,IStream);
Bytes := MemoryStream.GetBuffer();
AllegatoText.ADDTEXT(Convert.ToBase64String(Bytes));
END;
My problem is that when I'll go to read, from my BLOB field, a file XPS that's impossible to open.
I have notice that's problem had coming when the dimension of file is more of 240Kb.
So, someone of did you had just solved this problem?
thanks.
0
Answers
Try to replace
Bytes := MemoryStream.GetBuffer();
with
Bytes := MemoryStream.ToArray();
Gunnar Gestsson
Microsoft Certified IT Professional
Dynamics NAV MVP
http://www.dynamics.is
http://Objects4NAV.com