how to read blob data from c#

vinceliu666vinceliu666 Member Posts: 51

As you knows , NAV could store big Text string data type to BLOB data type in sql server.
It works fine in NAV read and write.

//---write
CLEAR(Ostream);
myTestRec.INIT;
myTestRec."No.":='SO123456';
myTestRec."Line No":=10000;
myTestRec.Comment.CREATEOUTSTREAM(Ostream,TEXTENCODING::UTF8);
Com.WRITE(Ostream);
myTestRec.INSERT;


//---read & show
CLEAR(InStream);
myTestRec.RESET;
myTestRec.SETRANGE("No.",'SO123456');
IF myTestRec.FINDFIRST THEN
REPEAT

myTestRec.CALCFIELDS(Comment);
IF myTestRec.Comment.HASVALUE THEN BEGIN
myTestRec.Comment.CREATEINSTREAM(InStream,TEXTENCODING::UTF8);
InStream.READ(Txt);
MESSAGE(Txt);
END;

But how could I to read it out from sql server ,convert the BLOB data to varchar and show it on page by C# .
It seems always appeared garbled.

Answers

  • vaprogvaprog Member Posts: 1,116
    Hi,

    There is an option "Compressed" on the BLOB field, which defaults to Yes.

    I don't know, if someone reverse engineered the compression scheme.

    I believe, if you turn this off, you should be able to consume if from c#.
Sign In or Register to comment.