# Yet another problem with reports! "Object reference not set to an instance of an object."

**URL:** <https://forums.toadworld.com/t/yet-another-problem-with-reports-object-reference-not-set-to-an-instance-of-an-object/35108>\
**Category:** Toad Data Point & Toad Intelligence Central\
**Created:** [February 17, 2016, 10:54pm UTC](https://forums.toadworld.com/t/yet-another-problem-with-reports-object-reference-not-set-to-an-instance-of-an-object/35108 "2016-02-17T22:54:05Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![christunger](https://avatars.discourse-cdn.com/v4/letter/c/5f9b8f/32.png) [@christunger](https://forums.toadworld.com/u/christunger)\
**Post date:** [February 17, 2016, 10:54pm UTC](https://forums.toadworld.com/t/yet-another-problem-with-reports-object-reference-not-set-to-an-instance-of-an-object/35108/1 "2016-02-17T22:54:05Z")

</div>

\*\*There needs to be some heavy considerations on taking a second look at the integrity of your reporting product. \*\*

Working on a report pulling data from SQL server, spend two hours prepping and finalizing the report. Saved often, previewed, exported my results and got it exactly where it needed to be. I then hit the automation button to begin completing that process. Included Toad Report under Database Activities for my first report export, which exports report results to an excel file. That part works fine. Added a second Toad Report action and set this one to export an html file that would then be embedded in to my Email action body. Save my automation and run. It craps out on the second Toad Report action. Returns the error: “Object reference not set to an instance of an object.” I attempt to troubleshoot and open the report and it now returns the error “This report is specific to the Sql Server platform and cannot be run using the current connection.” Keep in my mind, I haven’t physically changed my connection at any point. Every activity in this process ties back to my NOC\_Reporting connection. I can’t even edit this report at this point.

Since I can’t physically open this report now in TDP, after spending hours developing, I attempted to open the tdr file in Visual Studio along with the first report in the automation to see if anything stood out. Low and behold, the connection string in the msprop:Connection="" syntax was completely wiped out in the broken report. So I attempted to copy the string from the report that worked and paste it in to the one that broke and no luck. I can’t seem to salvage my work and needless to say I’m pretty frustrated.

Here’s is the data from my log file. I’ve x’d out sensitive info.

– 2/18/2016 12:25:59 AM: TimeToKnow\_PrevDay.log: Setting up environment  
– 2/18/2016 12:25:59 AM: TimeToKnow\_PrevDay.log: Script run by Toad Data Point 3.6.0.3276  
– 2/18/2016 12:25:59 AM: TimeToKnow\_PrevDay.log: Build started  
– 2/18/2016 12:25:59 AM: TimeToKnow\_PrevDay.log: Compiling script  
– 2/18/2016 12:25:59 AM: TimeToKnow\_PrevDay.log: Start CompileWorkflow  
– 2/18/2016 12:25:59 AM: TimeToKnow\_PrevDay.log: Before Compile  
– 2/18/2016 12:26:01 AM: TimeToKnow\_PrevDay.log: Return from CompileWorkflow  
– 2/18/2016 12:26:01 AM: TimeToKnow\_PrevDay.log: Wokrflow Compiled without Errors  
– 2/18/2016 12:26:01 AM: TimeToKnow\_PrevDay.log: Build completed  
– 2/18/2016 12:26:01 AM: TimeToKnow\_PrevDay.log: Create Workflow instance  
– 2/18/2016 12:26:01 AM: TimeToKnow\_PrevDay.log: Started workflow instance  
– 2/18/2016 12:26:01 AM: TimeToKnow\_PrevDay.log: Begin execution script activities  
– 2/18/2016 12:26:01 AM: TimeToKnow\_PrevDay.log: Started generating report  
– 2/18/2016 12:26:01 AM: TimeToKnow\_PrevDay.log: Connection description = XXX.XX.XXX.X (XXXX), NOC\_Reporting  
– 2/18/2016 12:26:01 AM: TimeToKnow\_PrevDay.log: Connection node found  
– 2/18/2016 12:26:01 AM: TimeToKnow\_PrevDay.log: Connection to: NOC\_Reporting  
– 2/18/2016 12:26:01 AM: TimeToKnow\_PrevDay.log: Connection successful  
– 2/18/2016 12:26:01 AM: TimeToKnow\_PrevDay.log: Connection logon: XXXX  
– 2/18/2016 12:26:01 AM: TimeToKnow\_PrevDay.log: Last schema: NOC\_Reporting  
– 2/18/2016 12:26:01 AM: TimeToKnow\_PrevDay.log: Default schema: NOC\_Reporting  
– 2/18/2016 12:26:01 AM: TimeToKnow\_PrevDay.log: Auto Commit: True  
– 2/18/2016 12:26:08 AM: TimeToKnow\_PrevDay.log: Row count set to 24 rows  
– 2/18/2016 12:26:08 AM: TimeToKnow\_PrevDay.log: Exporting to X:\XXX\TimeToKnow\_PrevDay\_Detail\_2016-02-18.xlsx  
– 2/18/2016 12:26:08 AM: TimeToKnow\_PrevDay.log: Report Finished, click TimeToKnow\_PrevDay\_Detail\_2016-02-18.xlsx to view file.  
– 2/18/2016 12:26:08 AM: TimeToKnow\_PrevDay.log: Started generating report  
– 2/18/2016 12:26:08 AM: TimeToKnow\_PrevDay.log: Opening Cross-Query connection  
– 2/18/2016 12:26:09 AM: TimeToKnow\_PrevDay.log: Report\_2 - Object reference not set to an instance of an object.

– 2/18/2016 12:26:09 AM: TimeToKnow\_PrevDay.log: Start error email  
– 2/18/2016 12:26:09 AM: TimeToKnow\_PrevDay.log: Email To: [xxx@xxx.com](mailto:xxx@xxx.com), From: [xxx@xxx.com](mailto:xxx@xxx.com), cc:  
– 2/18/2016 12:26:09 AM: TimeToKnow\_PrevDay.log: Email Subject: Automation Script Error  
– 2/18/2016 12:26:09 AM: TimeToKnow\_PrevDay.log: Generating exception Email  
– 2/18/2016 12:26:09 AM: TimeToKnow\_PrevDay.log: Email message:

Automation script “TimeToKnow\_PrevDay” had errors while executing. The exception messages are listed below and the log file is attached.

Exception Messages:  
Report\_2 - Object reference not set to an instance of an object.

What I don’t understand is why, if both reports were initially built utilizing the same connection (NOC\_Reporting), the second report attempts to open a cross-query connection (highlighted above).

---

<div class="post-metadata">

**Author:** ![Debbie\_Peabody](https://sea1.discourse-cdn.com/quest/user_avatar/forums.toadworld.com/debbie_peabody/32/18_2.png) [@Debbie\_Peabody](https://forums.toadworld.com/u/Debbie_Peabody)\
**Post date:** [February 18, 2016, 8:07am UTC](https://forums.toadworld.com/t/yet-another-problem-with-reports-object-reference-not-set-to-an-instance-of-an-object/35108/2 "2016-02-18T08:07:25Z")

</div>

If you connection type is SQL Server you can manually edit the tdr file in text editor and set the the connection property.

msprop:ConnectionType=“SqlServer”

I do not know why is wants to use a cross-connection. If you post the tdr file I can look at the SQL and see if I can see why.

---

<div class="post-metadata">

**Author:** ![christunger](https://avatars.discourse-cdn.com/v4/letter/c/5f9b8f/32.png) [@christunger](https://forums.toadworld.com/u/christunger)\
**Post date:** [February 18, 2016, 9:28am UTC](https://forums.toadworld.com/t/yet-another-problem-with-reports-object-reference-not-set-to-an-instance-of-an-object/35108/3 "2016-02-18T09:28:28Z")

</div>

Thanks Debbie,

Both reports contain that string as you mentioned in your response. The Mobile Report version is the report that has crashed on me.

Mobile Report: TimeToKnow\_PrevDay\_Mobile.tdr:

msprop:ConnectionType=“SqlServer”

msprop:Connection=""

Detail Report: TimeToKnow\_PrevDay\_Detail.tdr:

msprop:ConnectionType=“SqlServer”

msprop:Connection=“XXX.XX.XXX.X (xxxx), NOC\_Reporting”

I tried copying and pasting the msPropConnection=”XXX.XX.XXX.X (xxxx) NOC\_Reporting” string from the Detail Report and pasting that in the Mobile Report in Visual Studio. Saved the file and attempted to open the report in TDP and it continues to return the error: “The report is specific to the SQL Server platform and cannot be run using the current connection.”

When you view the Mobile Report code, you’ll see the update to the mspropConnection string to reflect the Detail Report string.  
[TimeToKnow\_PrevDay\_Detail\_and\_Mobile.zip](https://global.discourse-cdn.com/quest/original/2X/3/33baa8ccd34af34634fc54a925eeb59f7bcf0645.zip) (10.8 KB)

---

<div class="post-metadata">

**Author:** ![Debbie\_Peabody](https://sea1.discourse-cdn.com/quest/user_avatar/forums.toadworld.com/debbie_peabody/32/18_2.png) [@Debbie\_Peabody](https://forums.toadworld.com/u/Debbie_Peabody)\
**Post date:** [February 19, 2016, 6:20pm UTC](https://forums.toadworld.com/t/yet-another-problem-with-reports-object-reference-not-set-to-an-instance-of-an-object/35108/4 "2016-02-19T18:20:52Z")

</div>

I looked into this today and was not able to reproduce the error. I agree that opening a Cross-Connection connection make no sense. I thought at first it might be the With statement you are using but I build my own simple one and had no issues,.

Is this reproducible? Or did it happen just the one time? If it is reproducible I continue to work with you to debug.

---

<div class="post-metadata">

**Author:** ![christunger](https://avatars.discourse-cdn.com/v4/letter/c/5f9b8f/32.png) [@christunger](https://forums.toadworld.com/u/christunger)\
**Post date:** [February 22, 2016, 3:07pm UTC](https://forums.toadworld.com/t/yet-another-problem-with-reports-object-reference-not-set-to-an-instance-of-an-object/35108/5 "2016-02-22T15:07:31Z")

</div>

Hi Debbie,

This is the first time that this has happened. Completely random.

---

<div class="post-metadata">

**Author:** ![christunger](https://avatars.discourse-cdn.com/v4/letter/c/5f9b8f/32.png) [@christunger](https://forums.toadworld.com/u/christunger)\
**Post date:** [March 4, 2016, 9:37am UTC](https://forums.toadworld.com/t/yet-another-problem-with-reports-object-reference-not-set-to-an-instance-of-an-object/35108/6 "2016-03-04T09:37:54Z")

</div>

Hi Debbie,

I think I may have found the culprit. I think it stems from the following steps:

From the Navigation Manager -

Right clicking on a view name (we’ll use “dbo.View1” as example) under my NOC\_Reporting database and selecting Generate SQL \> Select statement \> To Editor.

When a new editor window is initiated, the select statement is populated in that window. By default, in the FROM syntax of the SQL statement, the database name and view name is listed. So for this example the SQL populated by Toad was:

SELECT Field1, Field2, Field3

FROM NOC\_Reporting.dbo.View1;

When I hit F5 to run the query, I’m prompted with a message stating: “Cross-connection queries cannot execute in a standard editor. Do you want to change in to cross-connection mode?” By default I always selected “No” because there was no need for that. Even though I select No, the data runs and produces results. From there I would right-click in the results returned and send to a data report. From here, I’m able to design, save, and preview the report. However, the minute I close the report and try to reopen it, this is when I received the error I originally posted about.

Backing up to the default SQL syntax I listed above. If I replicate the same steps:

Right clicking on dbo.View1 under my NOC\_Reporting database and selecting Generate SQL \> Select statement \> To Editor.

Another editor initiates and the default select syntax is populated like before:

SELECT Field1, Field2, Field3

FROM NOC\_Reporting.dbo.View1;

This time I removed “NOC\_Reporting.” from the FROM statement so that the syntax reflected:

SELECT Field1, Field2, Field3

FROM dbo.View1;

When I hit F5 to run the query, the Cross-connection prompt didn’t pop. I then sent the selected results in to a report, saved, closed, and re-opened the same way I listed above and it worked without issue.

---

<div class="post-metadata">

**Author:** ![Debbie\_Peabody](https://sea1.discourse-cdn.com/quest/user_avatar/forums.toadworld.com/debbie_peabody/32/18_2.png) [@Debbie\_Peabody](https://forums.toadworld.com/u/Debbie_Peabody)\
**Post date:** [March 4, 2016, 9:52am UTC](https://forums.toadworld.com/t/yet-another-problem-with-reports-object-reference-not-set-to-an-instance-of-an-object/35108/7 "2016-03-04T09:52:34Z")

</div>

There is something here that is not making sense to me. There is something in that generated SQL statement that is triggering the Cross-Connection code. Can you generate the SQL and send to editor. make sure it executes and then generate a support bundle? In would like the SQLAnlyze.log out of the bundle. This gives me the original SQL and generated DDL so i can try to replicate the issue.

---

<div class="post-metadata">

**Author:** ![christunger](https://avatars.discourse-cdn.com/v4/letter/c/5f9b8f/32.png) [@christunger](https://forums.toadworld.com/u/christunger)\
**Post date:** [March 4, 2016, 10:52am UTC](https://forums.toadworld.com/t/yet-another-problem-with-reports-object-reference-not-set-to-an-instance-of-an-object/35108/8 "2016-03-04T10:52:17Z")

</div>

Hey Debbie, I ran the query and went to Help and selected Support Bundle. Going through the email generated and the attached zip file, I couldn’t find anything like SQLAnlyze.log. Was this the correct way to generate, or should I be doing something different?

Thanks!

---

<div class="post-metadata">

**Author:** ![Debbie\_Peabody](https://sea1.discourse-cdn.com/quest/user_avatar/forums.toadworld.com/debbie_peabody/32/18_2.png) [@Debbie\_Peabody](https://forums.toadworld.com/u/Debbie_Peabody)\
**Post date:** [March 4, 2016, 4:25pm UTC](https://forums.toadworld.com/t/yet-another-problem-with-reports-object-reference-not-set-to-an-instance-of-an-object/35108/9 "2016-03-04T16:25:57Z")

</div>

The window that has to have focus is the window that contains the SQL. You will also see a prompt that asks if you want to include the number of rows. I added this in TDP 3.8 or 3.7. What version are you using?

---

<div class="post-metadata">

**Author:** ![christunger](https://avatars.discourse-cdn.com/v4/letter/c/5f9b8f/32.png) [@christunger](https://forums.toadworld.com/u/christunger)\
**Post date:** [March 7, 2016, 7:26am UTC](https://forums.toadworld.com/t/yet-another-problem-with-reports-object-reference-not-set-to-an-instance-of-an-object/35108/10 "2016-03-07T07:26:38Z")

</div>

The current version on my laptop is 3.6. I’ll put in a request for a version upgrade. I know we have 3.7 packaged, but I’ll check on 3.8 as well. Also, my reporting machine is running 3.7. I’ll hop on that box to see if I can reproduce the occurrence. If so, I’ll attempt to provide you the file you’re requesting.

---

<div class="post-metadata">

**Author:** ![christunger](https://avatars.discourse-cdn.com/v4/letter/c/5f9b8f/32.png) [@christunger](https://forums.toadworld.com/u/christunger)\
**Post date:** [March 7, 2016, 7:31am UTC](https://forums.toadworld.com/t/yet-another-problem-with-reports-object-reference-not-set-to-an-instance-of-an-object/35108/11 "2016-03-07T07:31:10Z")

</div>

So the occurrence did replicate on my report box and here is the output from the SQLAnalyze.log file:

===== 3/7/2016 9:27:33 AM =====

Tables for query: SELECT Remedy\_Login\_ID, Full\_Name, Support\_Group\_Name, Default\_x

FROM NOC\_Reporting.dbo.v\_Remedy\_NOC\_Agents

Executed on SqlServer, connection name NOC\_Reporting, on schema NOC\_Reporting

Datasource: SqlServer

Version: 11.0.3128.0

CREATE TABLE NOC\_Reporting.dbo.v\_Remedy\_NOC\_Agents (

Remedy\_Login\_ID nvarchar(254),

Full\_Name nvarchar(128),

Support\_Group\_Name nvarchar(60),

Default\_x varchar(3));

Row count for table NOC\_Reporting.dbo.v\_Remedy\_NOC\_Agents: 55

Would you care for the whole support zip as well?

---

<div class="post-metadata">

**Author:** ![Debbie\_Peabody](https://sea1.discourse-cdn.com/quest/user_avatar/forums.toadworld.com/debbie_peabody/32/18_2.png) [@Debbie\_Peabody](https://forums.toadworld.com/u/Debbie_Peabody)\
**Post date:** [March 8, 2016, 1:41pm UTC](https://forums.toadworld.com/t/yet-another-problem-with-reports-object-reference-not-set-to-an-instance-of-an-object/35108/12 "2016-03-08T13:41:00Z")

</div>

Thanks for the SQL. I can reproduce this behavior but it isn't really an error. For Cross-connections, the only way we can figure out what datasource a table comes from is to prepend the connection name to the table/view. This is our own syntax. We use the Property name the user assigns the connection. In this case the Name of your connection is the same as the same as the SQL Server database. So we think it might be a cross-connection query. See below. When this SQL combination and named connection are used in automation you will get the error combination you show at the top of this thread.

To work around this, change the name of your connection. For me I had to delete the connection all together and re-add, giving a completely different name. Once that was done the automation script worked fine. Give it a try.

 ![CrossQuery.png](https://global.discourse-cdn.com/quest/original/2X/6/64bdc4ee2cdcb5f6431e3a4e26f55f7e0f2e9829.png)

---

<div class="post-metadata">

**Author:** ![christunger](https://avatars.discourse-cdn.com/v4/letter/c/5f9b8f/32.png) [@christunger](https://forums.toadworld.com/u/christunger)\
**Post date:** [March 8, 2016, 2:12pm UTC](https://forums.toadworld.com/t/yet-another-problem-with-reports-object-reference-not-set-to-an-instance-of-an-object/35108/13 "2016-03-08T14:12:22Z")

</div>

Thanks Debbie, I will try renaming the connection as you suggested. To your point, even though this isn’t technically an error in this context, this did become a break point when I would right click on the results returned and send them to a Data Report. After saving, closing, and attempting to open the report back up, I received the error that I posted in my original post on this topic.

---

<div class="post-metadata">

**Author:** ![Debbie\_Peabody](https://sea1.discourse-cdn.com/quest/user_avatar/forums.toadworld.com/debbie_peabody/32/18_2.png) [@Debbie\_Peabody](https://forums.toadworld.com/u/Debbie_Peabody)\
**Post date:** [March 11, 2016, 7:32pm UTC](https://forums.toadworld.com/t/yet-another-problem-with-reports-object-reference-not-set-to-an-instance-of-an-object/35108/14 "2016-03-11T19:32:10Z")

</div>

You do have a point. But unfortunately I cannot reproduce and I need to reproduce in order to fix it.
