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
InitializeCFront
and
ConnectToServer
one after another.
I have tried to specify the database in the ConnectServerAndOpenDatabase function, but doesn't help.
(Thanks if any of you were trying to help)
Shall you post the solution for others who will have same problem?
Thanks.
MVP - Dynamics NAV
My BLOG
NAVERTICA a.s.
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
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 )
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
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
Hi,
Can you share with me what exactly you did? Provide steps.
Thanks,
Bhavin
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.
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?