Reputation: 37
I added reference for ax but i don't know how to connect AX to read data through vb.net code,
can any one suggest me samples for that?
Thanks in advance
Upvotes: 0
Views: 231
Reputation: 1
use this kind of method to call ax in vb;
Partial Public Class ValueReport
<DataMethod(), AxSessionPermission(SecurityAction.Assert)> Public Shared Function CompanyInfo() As DataTable
Dim dtCompany As New DataTable
Try
Dim record As AxaptaRecordWrapper = SessionManager.GetSession().CreateAxaptaRecord("CompanyInfo")
record.ExecuteStmt("select * from %1")
dtCompany.Columns.Add("CompanyName", System.Type.GetType("System.String"))
dtCompany.Columns.Add("CompanyAddress", System.Type.GetType("System.String"))
While (record.Found)
Dim drCompany As DataRow = dtCompany.NewRow
drCompany("CompanyName") = record.GetField("Name")
drCompany("CompanyAddress") = record.GetField("Address")
dtCompany.Rows.Add(drCompany)
record.Next()
End While
Return dtCompany
Catch ex As Exception
Throw ex
End Try
End Function
Upvotes: 0
Reputation: 1496
You need to the AxaptaRecord
class and call .next()
on it to read through the results.
There is some c# sample code available that you should be able to convert to VB .NET here: How to: Read Data Using .NET Business Connector
Upvotes: 1