Hi, I'm trying to consume a service operation from AX in a console C# application, that returns a DataTable, but I keep getting:
Input String was not in a correct format
In the console application.
This is the method in AX:
[SysEntryPointAttribute(true)] public System.Data.DataTable sendSalesOrderInfo() { SalesTable salesTable = SalesTable::find("001"); System.String salesId, accountNum, salesName; System.Data.DataTable dt = new System.Data.DataTable(); System.Data.DataColumnCollection columns = dt.get_Columns(); System.Data.DataRowCollection rows = dt.get_Rows(); System.Data.DataColumn salesIdColumn, custAccountColumn, salesNameColumn; System.Data.DataRow dataRow; salesIdColumn = new System.Data.DataColumn("SalesId", System.Type::GetType("System.String")); custAccountColumn = new System.Data.DataColumn("CustAccount", System.Type::GetType("System.String")); salesNameColumn = new System.Data.DataColumn("SalesName", System.Type::GetType("System.String")); columns.Add(salesIdColumn); columns.Add(custAccountColumn); columns.Add(salesNameColumn); dataRow = dt.NewRow(); salesId = System.Convert::ToString(salesTable.SalesId); accountNum = System.Convert::ToString(salesTable.CustAccount); salesName = System.Convert::ToString(salesTable.SalesName); dataRow.set_Item("SalesId", salesId); dataRow.set_Item("CustAccount", accountNum); dataRow.set_Item("SalesName", salesName); rows.Add(dataRow); return dt; }
I would appreciate your help, thanks!