web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics GP (Archived)

GP 2013 With Visual Studio 2010

(0) ShareShare
ReportReport
Posted on by 210

Hi,

Please help, I am struggling about 2 weeks on this issue:

Thanks in advanced.

Regards,

Jim

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Congruent Dynamics Profile Picture
    735 on at

    Hi Jim,

    Make sure that you must add the "application.dyamics" reference in the project, also check the version of the application.dynamics version. Right click the application.dynamics and click properties and check the version.

  • JimLCM Profile Picture
    210 on at

    Hi,

    Thanks for replied. 

    I have recreated my project to test on my application.

    Here the screen shot for issue:

    6471.References1.png

    References version Screen shot:

    4274.References2.png

    8244.References3.png

    Software Info:

    GP Dynamics 2013

    Windows 7

    Visual Studio 2010

    My codes:

    GPUser Class


    Public Class GPUser

    Public ReadOnly Property DataBase As String
    Get
    Return Dynamics.Globals.IntercompanyId.Value
    End Get
    End Property

    Public ReadOnly Property UserID As String
    Get
    Return Dynamics.Globals.IntercompanyId.Value
    End Get
    End Property

    Public ReadOnly Property Password As String
    Get
    Return Dynamics.Globals.SqlPassword.Value
    End Get
    End Property

    Public ReadOnly Property DataSource As String
    Get
    Return Dynamics.Globals.SqlDataSourceName.Value
    End Get
    End Property


    Public ReadOnly Property ConnectionString As SqlClient.SqlConnectionStringBuilder
    Get
    Return New SqlClient.SqlConnectionStringBuilder With {.DataSource = DataSource, .UserID = UserID, .Password = Password, .ApplicationName = "GP", .InitialCatalog = DataBase}
    End Get

    End Property

    Public ReadOnly Property CompanyId As Short
    Get
    Return Dynamics.Globals.CompanyId.Value
    End Get
    End Property
    Public ReadOnly Property UserDate As DateTime
    Get
    Return Dynamics.Globals.UserDate.Value
    End Get
    End Property

    End Class

    My Form Codes:

    Private Sub SimpleButton1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SimpleButton1.Click


    Dim myTestClass As New GPUser
    MsgBox(myTestClass.ConnectionString) <-- This line triggered error

    Dim cn As New System.Data.SqlClient.SqlConnection()

    Dim cmd As New System.Data.SqlClient.SqlCommand()

    Dim rst As System.Data.SqlClient.SqlDataReader
    Dim resp As Int32

    Microsoft.Dexterity.GPConnection.Startup()

    ' Create the connection object
    Dim GPConnObj As New Microsoft.Dexterity.GPConnection()

    ' Initialize
    resp = GPConnObj.Init("<Key1>", "<Key2>")

    ' Make the connection
    cn.ConnectionString = "DATABASE=TWO"
    GPConnObj.Connect(cn, "GP", "LESSONUSER1", "access")

    ' Check the return code
    If ((GPConnObj.ReturnCode And
    CType(Microsoft.Dexterity.GPConnection.ReturnCodeFlags.SuccessfulLogin, Integer)) = CType(Microsoft.Dexterity.GPConnection.ReturnCodeFlags.SuccessfulLogin, Integer)) Then

    ' Specify the command retrieve all customers
    cmd.Connection = cn
    cmd.CommandText = "Select * From RM00101"

    ' Execute the command
    rst = cmd.ExecuteReader()
    rst.Read()

    ' Display the name of the first customer
    MessageBox.Show((rst.GetValue(1).ToString()))

    ' Close the connection
    cn.Close()
    Else
    MessageBox.Show("Login failed")
    End If

    ' Dispose of the connection object
    GPConnObj = Nothing
    'Shut down the object
    Microsoft.Dexterity.GPConnection.Shutdown()

    End Sub

    Hope can hear from you again soonest. :)

    Regards,

    Jim

  • Suggested answer
    sandipdjadhav Profile Picture
    18,306 on at

    Hello,

    Did you add GPCon.dll files in your project?

    Thanks

    Sandip

  • JimLCM Profile Picture
    210 on at

    Hi Sandip,

    I have added the GPConn.dll but still got the same error.

    FYI, the sample app was working fine on previous version when using retrieveglobals9.dll.

    When I did the same concept on GP2013 with GPCOnn or GPConnNet, I got this error.

    My App concept was:

    1. User login to GP

    2. User Click shortcut on GP to run external program, for example GP customize report.

    3. The external program able to use the User logon information to connect DB Server and display User Logon Information on screen / report.

    Jim

  • Steve Kubis Profile Picture
    on at

    I suspect that the problem is that you have a conflict created by  two versions of the .NET framework (2.0 and 4.0) used for the assemblies. For GP 2013, your add-in needs to target the .NET 4.0 framework. But, the GPConnNet assembly you're referencing is targeting the .NET 2.0 framework.

    Check the version of the framework that the project is targeting. You can see that in the Project Properties. I think that should be the .NET 4 Client Framework. With that setting, the project should also be able to load the GPConnNet assembly.

  • JimLCM Profile Picture
    210 on at

    Hi Steve,

    My project was targeted .Net 4 Framework.

    Just for your information, the error was triggered when the class try to read properties values from Dynamics.Globals.

    Regards,

    Jim

  • Steve Kubis Profile Picture
    on at

    If memory serves, Dynamics.Globals comes from the Dynamics application assembly -- Application.Dynamics.dll.  Are referencing the Application.Dynamics.dll from the Dynamics GP installation? You can check the path in the properties for the assembly.

    One other question -- you didn't re-build the Application.Dynamics.dll, did you? That assembly is signed by Microsoft, so you shouldn't rebuild it with DAG.exe, because then the digital signature is lost. Then the assembly won't load.

  • JimLCM Profile Picture
    210 on at

    Hi Steve,

    I have add the application.Dyanmics.dll in my project reference. I didn't rebuilt it with DAG.exe.

    Please see the previous attached screen shot for your perusal.

    Regards,

    Jim

  • Steve Kubis Profile Picture
    on at

    I can see that the Application.Dynamics file is referenced, but the Path is cut off. I can't tell if it's being referenced from the "GP" folder, or from the "Visual Studio Tools" folder. You should reference the assembly from the "GP" folder, because that's the version that is loaded by Dynamics GP when it's running.

    The other thing you can try is to use "Fuslogvw" to check for assembly binding failures. Here are some quick instructions to use this tool that's included with Visual Studio:

    1) Start fuslogvw.exe with administrative privileges from a Visual Studio command prompt.

    2) Start Dynamics GP.

    3) Configure fuslogvw.exe to capture the events.

    4) Perform the action that causes the binding error.

    5) Look at the log.

    6) Be sure to turn off the logging after you're done. Even when you close the tool, logging would continue until you turn it off.

  • JimLCM Profile Picture
    210 on at

    Hi Steve,

    Thanks for advice.

    The Application.Dynamics file was referenced from the GP Folder itself.

    For the log, I will try this tonight and update you the outcome. :)

    Another question, do I need install my application into GP installed folder before I run my application?

    Regards,

    Jim

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics GP (Archived)

#1
mtabor Profile Picture

mtabor 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans