Using Axapta Interfaces in VB.net Framework...

Dear All,

I am creating one DLL in Vb.net framework which access custtable information from axpata 3.0,

sqlstr = “select * from %1 where %1.accountnum == ‘4000’”…using this query we get data from single table i.e custtable.

But i want to retrieve information from two tables as we do in axapta with the query like “select custtable where custtable.accountnum == custtrans.accountnum”.

below is the source code for the DLL, which runs perfectly and gets output, but when i tried with two tables i am not getting any output .

anybody tell me how do i write the syntax retrieve data from two tables with joins in vb.net frame work using IAxapta interfaces.


Public Function fun_table()

Dim Axapta As Object

Dim Myrecord As Object

Dim Myrecord1 As Object

Dim myrecord2 As Object

Dim sqlstr As String

Axapta = CreateObject(“AxaptaCOMConnector.Axapta”)

Axapta.Logon()

Myrecord = Axapta.createrecord(“Mytable”)

Myrecord1 = Axapta.createrecord(“custtable”)

myrecord2 = Axapta.createrecord(“custtrans”)

‘’ Myrecord1.field(“purchid”) = “00008_049”

sqlstr = “select * from %1 where %1.accountnum == ‘4000’”

MsgBox(sqlstr)

Axapta.executestmt(sqlstr, Myrecord1)

While Myrecord1.found

MsgBox(Myrecord1.field(“accountnum”))

Myrecord.field(“name”) = Myrecord1.field(“accountnum”)

Myrecord.field(“address”) = Myrecord1.field(“name”)

Myrecord.insert()

Myrecord1.next()

End While

MsgBox(“def”)

End Function


Regards,

shabeer.

Hi Shabeer,

I think the query “Select * From CustTable Where CustTable.AccountNum == CustTrans.AccountNum” does not work under SQL Server QA. until you pass a fixed value into CustTrans.AccountNum.

sqlstr = “select * from %1 where %1.accountnum == ‘4000’”… Yes, it will work.

Regards,

Khue Trinh