问题
I need to customize AX to load an arbitrary file with arbitrary size and save it to database as a container field. I also need to read back from that container field and write the content into a file, which should contain exactly the same file content as before load.
I had tried with BinaryIO, unfortunately with no luck
回答1:
The answer to this question applies.
Especially you should use the system class BinData
and the methods loadFile
and saveFile
.
Example: this job copies the notepad
program to a temporary directory.
static void BinDataTest(Args _args)
{
BinData b = new BinData();
Container c;
b.loadFile(@"C:\Windows\notepad.exe");
info(int2str(b.size()));
c = b.getData();
b = new BinData();
b.setData(c);
info(int2str(b.size()));
b.saveFile(@"C:\Temp\notepad.exe");
}
来源:https://stackoverflow.com/questions/8207240/axapta-load-and-save-file-from-and-to-container-field