RDLC Main Report Error

9. July 2008

Lately I’ve been getting a ton of traffic directed to my log here regarding RDLC main report invalid errors.

To simply put verify that the Microsoft ReportViewer control is installed on the server these reports are being deployed to. Microsoft article on ReportViewer control is located here: http://msdn.microsoft.com/en-us/library/ms251671(VS.80).aspx

You can also download the ReportViewer control for use on the production system from the link below.

http://go.microsoft.com/fwlink/?LinkId=49981

The reason for the ‘invalid main report’ error, that is terribly descriptive huh, is due to the lack of the ReportViewer on the deployed system. This can be caused by the lack of Visual Studios (VS) being installed on the machine, as VS automagically installs the ReportViewer dependencies onto the system, and at that point will make the RDLC reports function.

If I can help anyone with RDLC related questions please email me at rob at coderrob dot com. I would like to see what has brought people looking for this answer, or if there is any additional content I should post regarding RDLC.

SQL Server

Execute SQL Stored Procedure within a Stored Procedure.

24. June 2008

I know anyone who uses a SQL database, or maybe even MySQL does stored procedures at some point. I also know at some point they’re going to want to abstract stored procedures to reduce redundancy. Anyway, if you’re looking to call an existing stored procedure from within a stored procedure it’s as simple as this…

InsertCustomerAddress – stored procedure being built

. . .

@customerID    bigint,
@address1 varchar(120),
@address2 varchar(100) = NULL,

. . .

DECLARE @returnValue smallint

EXECUTE @returnValue = InsertAddress @ address1, @address2

INSERT INTO dbo.CustomerAddress
(
                CustomerID,
                AddressID
)
. . .

You see that I declared a value of @returnValue in the datatype smallint. From there I simply executed another stored procedure that returns the unique ID created by inserting a new Address record. From there I used that return address ID to insert into my customer address reference table along with the customers ID.

That seems to be about it. Just call the Execute function from within the stored procedure; you don’t necessarily need to set a value to capture the return value as many procedures may not return any values. Just call Execute with a space, the name of the stored procedure to call, and the parameters to pass in. It is possible to put the keyword ‘output’ next to each parameter whose values will be altered within the called procedure.

SQL Server

Deploying client-side report definition files ... or RDLC reports

3. December 2007

I’m currently at work learning the nuances of the PHP language for an upcoming project. I was thinking about a way to start off the one sided conversation we’ll be having from now on, and then it hit me. I’d like to take a moment to help you solve a problem that plagued our development team for three days with RDLC reports.

Just recently I was attending a Microsoft MSDN event, and of all places while I was waiting at the line for the concession stand I overheard a group of three developers complaining about RDLC implementations, and Infragistics control sets. Having just rolled off a four month project where RDLC reports were part of my primary development tasks I learned quite a bit. I won’t touch on the Infragistics controls just yet as the pain of dealing with them is still very fresh within my thoughts.

The most important thing that I learned during this period of time is that deploying/publishing a website with RDLC reports is a big pain in the butt. What you’ll realize is after you’ve compiled and deployed your site the RDLC files drop from the 30+KB file sizes to a 1KB size. This change alone can throw some developers for a loop, but fear not this is normal. Unfortunately most of you out there that deploy these reports will be exposed right away to this wonderfully descript error:

“The definition of the report ‘Main Report’ is invalid”

Having stared blankly at this error, and considering we had no reports definitions named ‘Main Report’ this threw us for a loop. Looking up possible solutions to this error through Google amounted to a heap of nothing. There were forums after forums making off the wall suggestions to correct the problem, and even a few MSDN forums with advice that amounted to adding three .dll files to the GAC (global assembly cache) on the deployed server.

It wasn’t until we found this very obscure site that mentioned that by default the .Net framework does not include the ReportViewer control. In order to display reports correctly you’d need to additionally locate, download, and install the ReportViewer software on the website server. For our development systems this was never an issue as Visual Studio (VS) installs the ReportViewer once installed, but for our VS-less web hosting server this became an issue.

At the time of writing this blog entry you can find a reference to this Report Viewer control from the Microsoft download link below:

Microsoft Report Viewer Redistributable 2005 

Additionally you can search on the Microsoft.com website for the Microsoft Report Viewer Redistributable 2005 software. This will correct the ‘Main Report’ error, and hopefully at this point the reports will be displaying correctly. I’ve seen a lot of suggestions, everything from replacing the compiled versions of the RDLC reports with their source versions to including additional files into the GAC. The underling cause of this problem is most servers do not have Visual Studio (VS) installed, and without VS the report viewer control is not installed by default. Anyways, I hope you enjoyed my first blog, and I look forward to talking at you later.

SQL Server , , , ,