How to use SQLDataReader to Handle BLOB Fields in Business Central

ToninoTonino Member Posts: 1
Hi All,

I'm wondering if anyone have any experience using SqlDataReader to handle Blob,RecordID fields. Specifically, I have Blob(images,pdf,excel) fields in SQL databases and need to import them into Business Central On-Premises.

I did something like this but the files comes in BC corrupted.

SqlBinaryValue := SQLDataReader.GetSqlBinary(SQLPOS);
TempBlob.CreateOutStream(OutStr);
OutStr.WriteText(SqlBinaryValue.Value.ToString());
TempBlob.ToRecordRef(RecordRef, FieldRef.Number);

If anyone have any insights or guidance on this, I would greatly appreciate it.

Thanks.
Sign In or Register to comment.