Options

Test application crashing in cfrontsql.dll

havhav Member Posts: 299
Hi,
I have written a test applicaiton using C++ to connect to NAV database and update some records.
I am using NAV 2009 W1 R2 however i also have NAV 5.0 W1 installed on the same machine.
My NAV database resides on SQL Server 2008 R2.

My test application code is as below:-
#include "libload.h"
int main() 
{
            DBL_U8     *NDBCDriverName = (DBL_U8*)"NDBCS";
            DBL_U8     *NetType = (DBL_U8*)"Default";
            DBL_U8     ServerName = (DBL_U8*)"IM10\\SQLEXPRESS2008";            
            DBL_U8     *DatabaseName = (DBL_U8*)"TEST";
            DBL_U8     *NavisionPath = (DBL_U8*)"C:\\Program Files\\Microsoft Dynamics NAV\\60\\Classic\\";
            DBL_U8     *NavisionLicNameWithFullPath = (DBL_U8*)"P:\\WM40\\NAVLicence\\NAV2009\\license.flf";
	
	if(SessionInit((DBL_U8*)"cfrontsql.dll") == 0)
	{
		DBL_SetNavisionPath(NavisionPath);		
		DBL_LoadLicenseFile(NavisionLicNameWithFullPath);				
		DBL_ConnectServerAndOpenDatabase(NDBCDriverName,ServerName,NetType,DatabaseName,0,0,1,0,0); 
		
		if(!DBL_GetDatabaseName(DatabaseName))
		            DBL_OpenDatabase(DatabaseName,0,0);

		DBL_U8*CompanyNamePtr = DBL_NextCompany(CompanyNamePtr);
		if(*CompanyNamePtr != '\0')
		{
			DBL_OpenCompany(CompanyNamePtr);
                                       .......................
		}
		DBL_CloseCompany();
		DBL_CloseDatabase();
		DBL_Exit();
	}
             ..................
}

When i run the above application it crashes in cfrontsql.dll at the line where GetDatabaseName() function is called.

I have converted libload.c to libload.cpp and have compiled it successfully. The cfront.ocx and cfrontsql.dll resides in my code folder.
I have also registered cfront.ocx manually from my code folder.

I have called SetNavisionPath() since i have multiple versions of NAV installed. Also the license file is loaded from network path.

It seems to me that the connection is not established with the SQL server but i don't know why although i can open the NAV db in SSMS.

Please help resolve this problem.

Regards,
Hemant
Regards,
Hemant
MCTS (MB7-841 : NAV 2009 C/SIDE Solution Development)

Comments

  • Options
    GRIZZLYGRIZZLY Member Posts: 127
    Try to copy license file to the folder with cfrontsql.dll.
    Maybe that helps... Who knows )
    Sincerely yours, GRIZZLY
    Follow my blog at http://x-dynamics.blogspot.com
  • Options
    havhav Member Posts: 299
    Thanks for your reply.
    I tried doing this but with no luck.

    Regards,
    Hemant
    Regards,
    Hemant
    MCTS (MB7-841 : NAV 2009 C/SIDE Solution Development)
  • Options
    havhav Member Posts: 299
    Hi all,
    Can someone help me out to resolve this?

    Thanks,
    Hemant
    Regards,
    Hemant
    MCTS (MB7-841 : NAV 2009 C/SIDE Solution Development)
Sign In or Register to comment.