Hi All, I am new to Business Connector in AX.
I try to display customer Id and customer Name in Console window. I get the error as Supplied Method Arguments Are not Valid .
I am sharing my code , correct me where i am wrong.
Thanks In Advance,
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Dynamics.BusinessConnectorNet;
namespace BCClass_Demo
{
class Program
{
static void Main(string[] args)
{
Axapta ax;
AxaptaRecord axRecord,axRecord1;
String tableName = "CustTable";
String tableName1 = "DirPartyTable";
String sqlStmt = ("Select * from %2 join %1 where %2.RecId == %1.party");
Object cusid , name;
try
{
ax = new Axapta();
ax.Logon(null, null, null, null);
axRecord = ax.CreateAxaptaRecord(tableName);
axRecord1 = ax.CreateAxaptaRecord(tableName1);
axRecord.ExecuteStmt(sqlStmt);
while (axRecord.Found)
{
cusid = axRecord.get_Field("AccountNum");
name = axRecord1.get_Field("Name");
Console.WriteLine("CustAccountNum \t CustomerName" );
Console.WriteLine(cusid + "\t\t " +name);
axRecord.Next();
}
Console.ReadKey();
}
catch (Exception e)// I caught error as Supplied Method Arguments Are not Valid
{
Console.WriteLine("error" + e);
}
}
}
}
*This post is locked for comments