[solved]File XPS and BLOB in SQL Server 2012 standard

massimopasquali
massimopasquali Member Posts: 82
edited 2016-11-08 in NAV Three Tier
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.

Answers