I have been trying to get my C# program to insert records directly into a Dynamics AX 2009 database using the .NET business connector.
So far I can easly insert a string, int, int64, enum (NoYes), but it fails every time I try and insert a dateTime field (in AX the field is defined as UtcDateTime) with the error:
The supplied method arguments are not valid.
I'm sure this is something simple that I am just missing.
Snippet of code:
using (axRecord = ax.CreateAxaptaRecord("TempTable"))
{
// Fails on this line with error: The supplied method arguments are not valid.
axRecord.set_Field("DateField", DateTime.Now);
axRecord.Insert();
}
I have tried passing through as a string and using a dateTime.parseExact
, etc., but it still does not seem to work.