Navision Integration :(

vaibhav_soulvaibhav_soul Member Posts: 17
Hi folks!

This is my first post in the forum, though I have been a fan of this forum since a long long time!! A bit about me - I am a certified navision solution developer working for a company in Australia.

I am currently looking at integration between navision and one of our products. I was thinking about writing an integration module in .NET. Basically, I looked at the sample code given by microsoft and thought I would venture out to do it on my own. The first step is itself an issue now ](*,)

This is my code (C#.NET) -
public void InitializeCFront()
        {
            CFrontDotNet.DriverType = NavisionDriverType.Native;
            CFrontDotNet.NavisionPath = @"D:\Program Files\Microsoft Dynamics NAV\CSIDE Client";
            CFrontDotNet.Instance.Init();            
        }
        public void ConnectToServer()
        {
            try
            {
                CFrontDotNet.Instance.ConnectServerAndOpenDatabase("", NavisionNetType.NativeTcp, @"D:\Program Files\Microsoft Dynamics NAV\CSIDE Client\Database.fdb", 2000, false, true, "", "");
                CFrontDotNet.Instance.OpenCompany(CFrontDotNet.Instance.NextCompany(null)); // Open First Company
            }
            catch
            {
                CFrontDotNet.Instance.DisconnectServer();
            }
        }

I get an error saying -

"The Navision CFront initialization failed, with following error: . Please verify that CFront.dll/CFrontsql.dll are available and located in the directory where the application is started."

However, my directory does contain both the files. I have also added reference to CFRONT.OCX file. (I could not add the other two dlls - cfront and cfrontsql as reference - throws errors).

Can you please tell me what I am missing????? [-o<

Comments

  • vaibhav_soulvaibhav_soul Member Posts: 17
    By the way, I have a function that calls

    InitializeCFront
    and
    ConnectToServer

    one after another.

    I have tried to specify the database in the ConnectServerAndOpenDatabase function, but doesn't help.
  • vaibhav_soulvaibhav_soul Member Posts: 17
    Got it!!!!!

    (Thanks if any of you were trying to help)
  • kinekine Member Posts: 12,562
    Got it!!!!!

    (Thanks if any of you were trying to help)

    Shall you post the solution for others who will have same problem?

    Thanks.
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • WaldoWaldo Member Posts: 3,412
    Just wanted to post my two cents on this:
    Mind what you're doing when creating some kind of integration tool outside of NAV. With C/FRONT, no validation triggers are called withing NAV!

    Eric Wauters
    MVP - Microsoft Dynamics NAV
    My blog
  • vaibhav_soulvaibhav_soul Member Posts: 17
    Waldo wrote:
    Just wanted to post my two cents on this:
    Mind what you're doing when creating some kind of integration tool outside of NAV. With C/FRONT, no validation triggers are called withing NAV!

    That is true. I am using C/FRONT only to get some data out of the system. I prefer using MSMQ for rest of the operations (Only thing- I still need to figure out how exactly I would go about coding it).

    Another thing I have found is that there is no enough material out there about NAV integration with third party software. Its all trial and error. The only material that comes with the "doc" section is using C, and I dont know if there are lots of people who are new to Navision and would like to write integration with C. (ok, no more ranting :lol: )
  • vaibhav_soulvaibhav_soul Member Posts: 17
    kine wrote:
    Got it!!!!!

    (Thanks if any of you were trying to help)

    Shall you post the solution for others who will have same problem?

    Thanks.

    hmmm.. my EXE was going to a different folder than the one that is generally default for Visual Studio settings. So naturally it could not find the files! #-o

    Its just wierd that it took time to know what was happening :-k
  • WaldoWaldo Member Posts: 3,412
    Waldo wrote:
    Just wanted to post my two cents on this:
    Mind what you're doing when creating some kind of integration tool outside of NAV. With C/FRONT, no validation triggers are called withing NAV!

    That is true. I am using C/FRONT only to get some data out of the system. I prefer using MSMQ for rest of the operations (Only thing- I still need to figure out how exactly I would go about coding it).

    If i'm not mistaken, there is a how-to on MSDN somewhere... . Yep, here it is:
    http://msdn2.microsoft.com/en-us/library/ms952182.aspx

    Eric Wauters
    MVP - Microsoft Dynamics NAV
    My blog
  • bbgajjarbbgajjar Member Posts: 12
    kine wrote:
    Got it!!!!!

    (Thanks if any of you were trying to help)

    Shall you post the solution for others who will have same problem?

    Thanks.

    hmmm.. my EXE was going to a different folder than the one that is generally default for Visual Studio settings. So naturally it could not find the files! #-o

    Its just wierd that it took time to know what was happening :-k

    Hi,
    Can you share with me what exactly you did? Provide steps.

    Thanks,
    Bhavin
  • garakgarak Member Posts: 3,263
    Did you read THIS articles before?
    There are some examples. The cfront,dll should be in the folder where your exe is or it should be inclouded into the builded exe.
    Do you make it right, it works too!
  • KarlRhodesKarlRhodes Member Posts: 37
    I'm having exactly the same issue, but mine is a little more complicated I think.

    I am actually writing a number of web services using C# in VS2010 that use CFrontDotNet to communicate with a Nav 5.0 database.

    I am also writing a Winforms application as a test platform which is being developed in parallel on the same machine as my web services solution.

    If I run a method that connects to Navision on my winforms app, it works fine. If I cut and paste the same function into my web services app and try to run it, I get an error.

    The code I try to run is shown here...

    path = @C:\Program Files (x86)\Microsoft Dynamics NAV\CSIDE Client;
    cfront.SetNavisionPath(path);


    ... and the error I get is shown here...

    The Navision CFront initialization failed, with following error: . Please verify that CFront.dll/CFrontsql.dll are available and located in the directory where the application is started.

    Why is it a winforms application can SetNavisionPath ok, but a web services application running on the same server, with the same code can't?
Sign In or Register to comment.