"Object referenced not set to an instance of an object" error during database upgrade in Microsoft Dynamics SL

This article provides a solution to an error that occurs during database upgrade in Microsoft Dynamics SL.

Applies to:   Microsoft Dynamics SL
Original KB number:   2405736

Symptoms

Consider the following scenario in Database Maintenance in Microsoft Dynamics SL:

  • You open the Database Maintenance (98.290.00) screen and then select the Update Databases tab.
  • You select the Microsoft Dynamics SL system database in the System Database Name box and then select all associated Microsoft Dynamics SL application databases in the Databases box.
  • You select the appropriate update scenario in the Update Scenarios box.
  • You select Begin Processing.

In this scenario, you receive the following error message:

Error 91: Object referenced not set to an instance of an object

Cause

This problem occurs if a record exists in the Domain table of the Microsoft Dynamics SL system database that references a database name that no longer exists.

Additionally, this problem occurs if a record exists in the Domain table for a database that isn't found in the databases collection because the database wasn't restored.

Resolution

To resolve this issue, delete the invalid record from the Domain table in the Microsoft Dynamics SL system database by using SQL Server Management Studio. To do it, follow these steps.

Note

Before you follow the instructions in this article, make sure that you have a complete backup copy of the database that you can restore if a problem occurs.

  1. Using Query Analyzer or SQL Server Management Studio, access the appropriate system database, and then run the following statement to identify the record that has the invalid Database Name:

    SELECT DATABASENAME, * from DOMAIN
    
  2. Review the results for any database names that no longer exist or that are currently not being upgraded.

  3. Confirm that this record is invalid, and then run the following statement to delete this record:

    DELETE from DOMAIN where DatabaseName = 'XXXXXXXX' 
    --(replace XXXXXXXX with the invalid Database Name)