ConnectServerAndOpenDatabase errors

vbtrekvbtrek Member Posts: 14
We've integrated with NAV for a long (since NAV 3.7) from our VB6 application using CFRONT.

Within the last month all of our development PC's will no longer talk to NAV (currently using NAV 4.0 SP3).

The line of code that is failing has been in our software unchanged for many years, it's the call to ConnectServerAndOpenDatabase.

We have the NAV database on SQL Server 2000 (with SP4). I've recreated the code in VBScript here:
strServer = "MYSERVER"
strNetType = "Default"
strDatabase = "Navision 4"
strUsername = "sa"
strPWD = "mysapassword"


Set CFRONT = CreateObject("cfront.cfrontctrl.1")

CFRONT.StopOnAllExceptions = True
CFRONT.HideError = False
'CFRONT.SetNavisionPath "C:\Program Files\Microsoft Business Solutions-Navision 4.0\SDK\CFRONT"

CFRONT.ReleaseAllObjects
CFRONT.ConnectServerAndOpenDatabase "NDBCS", strServer, strNetType, strDatabase, 10000, False, False, strUsername, strPWD
Whether I do or don't call SetNavisionPath makes no difference.
I've reinstalled both my client and SDK but no difference.
When the code hits the ReleaseAllObjects I get the error:
C/FRONT Fatal Error: CFRONT.DLL or CFRONTSQL.DLL is not loaded. Use ConnectServerandOpenDatabase first or check the parameters. You might have the wrong path in SetNavisionPath call.
If i remove the ReleaseAllObjects call the VBScript engine simply crashes.

As it's all of our development PC's that have stopped working, I can only imaging that it's something to do with our network or server, but have run out of ideas. Can anyone help?
Derek Smith

Comments

  • kinekine Member Posts: 12,562
    The NavisionPath must lead to the installed NAV Client, not into the SDK folder. Try to install the NAV client and point the path there...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • vbtrekvbtrek Member Posts: 14
    Thanks for the reply, I've tried setting NavisionPath to the client folder and it didn't make any difference either.
    Derek Smith
  • kinekine Member Posts: 12,562
    Check that you have correct license with the C/Front granule in the path.
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • vbtrekvbtrek Member Posts: 14
    Yep got that, it's our development license and it does have the granule 1,800 C/FRONT there. The license is stored in the client path as fin.flf and it's also stored in the database.
    Derek Smith
  • kinekine Member Posts: 12,562
    May be that the name of the object is different than "cfront.cfrontctrl.1"?

    Did you tried to run the example from the SDK? I think I had same problem and the example was not working for me too...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • vbtrekvbtrek Member Posts: 14
    Looking in the registry "CFRONT.CFRONTCtrl.1" is the correct class name and if it weren't then the code would fail at the CreateObject line of code.

    I did also try the sample code in CFRONT.xls but this also fails on the same line of code "ConnectServerAndOpenDatabase" - at least it's consistent!

    I have also recieved an "Error 2 in Module 1" from some of the error handlers, which doesn't actually mean anything to me, but according to this file http://www.geocities.com/navision_attain/downloads/Errors_List.xls it means Err_OS_FileNotFound - but I don't know what file is not found.
    Derek Smith
  • kinekine Member Posts: 12,562
    May be at this point, when the example is not working too, is time to contact MS support and ask them, it seems like some bug...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • gedasgedas Member Posts: 87
    There are 2 examples of Cfront in Cfront installation.
    Sample.xls and sample.exe.
    What i do:
    - copy all cfront libraries to some test folder
    - copy license to the same folder
    - copy client files required by Cfront to the same folder.
    - run sample.exe -p"[path to current folder]".

    Sample must connect to db and start testing it. It doesn't matter that later comes error from db - connection was established so cfront works.

    sample.xls requires more work to work:) Usually it requires Cfront install, but you can make reference from VBA designer to cfront dll and add setnavisionpath() statement before connecserver.... Usually it works.

    There were many changes in CFRONT in 4.0: it becomes .net (reference must show to microsoft....cfront.dll); has changed path usage and there were many errors fixed. So if it isn't new error then everything must work.

    Regards
    GB
  • vbtrekvbtrek Member Posts: 14
    I believe I have now narrowed this down to a problem with Vista SP1. Any machine we've installed vista SP1 on will not work.

    I'm now going to report this to Microsoft.
    Derek Smith
  • kinekine Member Posts: 12,562
    Try to run the application under leveraged account (may be problem is in UAC).
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • vbtrekvbtrek Member Posts: 14
    UAC is disabled.
    Derek Smith
  • kinekine Member Posts: 12,562
    Do you know if it worked on Vista before SP1?
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • vbtrekvbtrek Member Posts: 14
    Yep, i've been the lead developer on NAV integration and regularly use our code to write to the NAV Journal (and it's been working for many years).
    Derek Smith
  • gedasgedas Member Posts: 87
    Just tested it - Cfront works on Vista 6.0.6001 Service Pack 1 Build 6001.
    So problems are somewhere else.
    GB
  • backmacbackmac Member Posts: 3
    Hi,

    I got the same problem on a Windows Server 2003 R2 with SP 2. Did anyone find a solution for the behavior of CFRONT.

    Best regards,

    Guido
Sign In or Register to comment.