Service start problem

Jul 4, 2007 at 11:36 AM
I have installed the software following your document and have got everything installed. On trying to start the service i am getting the following error in the application log:

Service cannot be started. System.NullReferenceException: Object reference not set to an instance of an object.
at MSCRMSageL50Adapter.MSCRMSageL50Adapter.OnStart(String[] args)
at System.ServiceProcess.ServiceBase.ServiceQueuedMainCallback(Object state)

I have setup the DSN to point to our data directory which in on a network share and have setup a new user to access the sage.

Do you have any ideas on what to try to solve this?

Kind regards,

Jul 5, 2007 at 8:13 AM

On CRM in the same page (Integration Settings) where you set the DSN is a checkbox for logging and a path for the log file. Can you set this and then post the log file.

First thing to check is that you can use the DSN you have created using Excel to make sure it can connect to Sage.

Also have you one and only one record in Integration Settings in CRM?


Jul 5, 2007 at 2:45 PM
Hi Julian

I just realised that i am using Line50 v2007 not 12 as i thought. I can access it through Excel ok, and thought that it would be ok. The log comes up with the following:

2007/07/05 14:42:40 - Sage -> Microsoft CRM Processing started...
2007/07/05 14:42:40 - Retrieving Sage Data.
2007/07/05 14:42:40 - CRMSageIntegration failed at method: ProcessCRMSageIntegration with exception: ERROR 08001 Cannot find all files in data path
ERROR 01000 The driver returned invalid (or failed to return) SQLDRIVERODBC_VER: 2.00
ERROR IM006MicrosoftODBC Driver Manager Driver's SQLSetConnectAttr failed
ERROR 01000MicrosoftODBC Driver Manager The driver doesn't support the version of ODBC behavior that the application requested (see SQLSetEnvAttr).

I guess i'll have to wait until it works with 2007 to get it working.

Kind regards,

Jul 11, 2007 at 1:17 AM

The error seems to relate to SQL 2005 from what I have discovered. I don't have access to Sage L50 v2007 as yet (and am about to go on holiday) so cannot look further into this for a few weeks.

The source code is posted so it you fancy having a go yourself you are quite welcome. The ODBC connection and retrieval code is fairly simple i.e.,

public static DataSet Retrieve()
CrmUtility.WriteToLog("Retrieving Sage Data.");

string strSageConn = CRMIntegrationSettings.SageConnectionString;

System.Data.Odbc.OdbcConnection oSageConnection = new OdbcConnection(strSageConn);

OdbcCommand cmdSelect;
string strSQLCmd = "";

//Retrieve all active Sage companies
strSQLCmd = "SELECT customers.* FROM SALESLEDGER customers where STATUSNUMBER=0";

cmdSelect = new OdbcCommand(strSQLCmd, oSageConnection);

//Setup Data Adapter
OdbcDataAdapter adapter = new OdbcDataAdapter(strSQLCmd, oSageConnection);

//Setup the Dataset
DataSet dsCustomers = new DataSet("SageL50");

//Populate the Dataset
adapter.Fill(dsCustomers, "SALES_LEDGER");

return dsCustomers;
Jul 11, 2007 at 9:43 AM
Hi Julian,

I managed to get it working. turns out i needed to put the whole UNC path in to the dsn instead of the mapped drive. Did that and it returns data and processes fine.

Thanks for your help in pointing me in the right direction.