Dynamics User Group
Since 1995 - The Microsoft Dynamics Online User Community

End Axapta User Session Using Microsoft Business Connector through Vb.Net

rated by 0 users
This post has 0 Replies | 1 Follower

Not Ranked
Posts 6
Points 75
Member since 05-29-2008
prashant_shetake Posted: 05-29-2008 9:39

         I have made an Application in VB.Net Using Micorsoft Business Connector where i used axapta logic. i logon to axapta and use the methods in axpata class when i logoff the axapta ,i also destroy the axapta object in vb.net.But still the user is shown in the  axapta online users list.

Following code write in my vb.net application :-

 Public Function AxaptaLogon(ByVal company As String) As Microsoft.Dynamics.BusinessConnectorNet.Axapta
        Try
            AxaptaObj = New Axapta
            AxaptaObj.Logon(company:=Trim(company), language:="", objectServer:=Trim(Gbl_ObjectServer), configuration:="")
            AxaptaLogon = AxaptaObj
        Catch ex As XppException
            AxaptaObj.Dispose()
            MsgBox(ex.Message, MsgBoxStyle.Exclamation, "Login error")
            AxaptaLogon = Nothing
            End
        End Try
        AxaptaObj = Nothing
    End Function

Private Sub FillCompanyLookup()
        Dim axRouteReference As AxaptaObject
        Dim CompanyBuffer As AxaptaRecord
        Dim Dt As New DataTable
        Dim Ds As New DataSet
        Dim dr As DataRow


        Try
            Dt.Columns.Add("ID", System.Type.GetType("System.String"))
            Dt.Columns.Add("Name", System.Type.GetType("System.String"))
            AxaptaObj = AxaptaLogon(Gbl_Company)
            axRouteReference = AxaptaObj.CreateAxaptaObject("PwC_VB_Route")

            CompanyBuffer = axRouteReference.Call("dataarea")

            Do
                If CompanyBuffer.Field("ID") <> "" Then
                    dr = Dt.NewRow
                    dr("ID") = CompanyBuffer.Field("ID")
                    dr("Name") = CompanyBuffer.Field("Name")
                    Dt.Rows.Add(dr)
                End If
            Loop While CompanyBuffer.Next
            Ds.Tables.Add(Dt)
            cmbCompany.Properties.DataSource = Ds.Tables(0)
            cmbCompany.Properties.DisplayMember = "ID"
            cmbCompany.Properties.ValueMember = "ID"
        Catch ex As XppException
            Call MsgBox(ex.Message)
        End Try
        AxaptaObj.Logoff()
        AxaptaObj = Nothing
        CompanyBuffer = Nothing
        axRouteReference = Nothing
        cmbCompany.Text = Gbl_Company
    End Sub

     How do i show the correct no.of users in the online users list...when i logoff .

  • | Post Points: 5
Page 1 of 1 (1 items) | RSS


Copyright Dynamics User Group, 1995-2009, all rights reserved. The Dynamics User Group is not affiliated with Microsoft Corporation.