I’m new to AX. I have an AX table with some string fields that I want to dump into my C# DataTable. This works fine. Now I want to do the same with an Image field defined in the AX table. But I don’t know how to cast this properly. Here is some code I am trying to use:
DataTable
dt = new DataTable();
dt.Columns.Add(new DataColumn(“FileType”, typeof(string)));
dt.Columns.Add(new DataColumn(“File_”, typeof(Image)));
using (axRecord = ax.CreateAxaptaRecord(“DocuValue”))
{
string strSQLName = "SELECT * FROM %1;
axRecord.ExecuteStmt(strSQLName);
while (axRecord.Found)
{
DataRow dr = dt.NewRow();
dr[“FileType”] = Convert.ToString(axRecord4.get_Field(“FileType”));
dr[“File_”] = axRecord4.get_Field(“File_”);
dt.Rows.Add(dr);
axRecord.Next();
}
}
ax.Logoff();
In AX table DocuValue, column File_ is defined as Image. I tried various casting techniques on line:
dr[“File_”] = axRecord4.get_Field(“File_”);
But I always get this error:
The supplied method arguments are not valid.
Like I said earlier, I can load the string field into my C# DataTable with no problem. It’s the Image column I cannot do. How can I do this?
Thanks,
Bob