Axapta:从容器字段加载文件和将文件保存到容器字段 [英] Axapta: Load and Save file from and to container field
问题描述
我需要自定义AX以加载具有任意大小的任意文件,并将其作为容器字段保存到数据库.我还需要从该容器字段中读回并将内容写入文件,该文件应包含与加载之前完全相同的文件内容.
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.
我曾经在BinaryIO上尝试过,不幸的是没有运气
I had tried with BinaryIO, unfortunately with no luck
推荐答案
此问题的答案适用.
特别是您应该使用系统类BinData
以及方法loadFile
和saveFile
.
The answer to this question applies.
Especially you should use the system class BinData
and the methods loadFile
and saveFile
.
示例:此作业将notepad
程序复制到一个临时目录中.
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");
}
这篇关于Axapta:从容器字段加载文件和将文件保存到容器字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!