Axapta: Load and Save file from and to container field

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-11 02:27:28

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!