Showing posts with label visual. Show all posts
Showing posts with label visual. Show all posts

Tuesday, March 27, 2012

Embedded code: what's the trick?

I am trying to put some embedded Visual Basic code into my report (RS 2005), using the "Code" section in the report properties.

Here's the function I'm trying to use:

Public Shared Function ReportTotal(ByVal IsUnitCost As Boolean,ByVal TotalDirectCosts As Double, ByVal SalaryBenefitsTotal As Double, ByVal IndirectRate As Double, ByVal SS_Screened As Integer, ByVal UnitRate As Double) As Double
If IsUnitCost Then
Return SS_Screened * UnitRate
Else
Return TotalDirectCosts + SalaryBenefitsTotal * IndirectRate
End If
End Function

Supposedly, after entering this you can access it in the expression for a field by typing the following: =Code.ReportTotal(... parameters ...)

However, when I try this, "ReportTalk" does not show up in the intellisense after I type "Code.". If I type it in anyway, a red squiggly line shows up under it, and if I attempt to preview the report, I get the following error: "The definition of report [report name] is invalid. Exception of type 'Microsoft.ReportingServices.ReportProcessing.ReportProcessingException' was thrown."

This is not a very helpful error message! I tried with and without "Public" and "Shared" and got the same thing.

What am I doing wrong?


Unfortunately, Custom code is not compiled until the report is published, so any custom methods will not show up in intellisense or be resolved (which results in the red underline) by the report designer.

If you are using RS 2005, then it should be evident in the exception message if the custom code generated the error. So, inorder to help you debug the issue I have a few questions:
What version of Reporting Services are you using?|||

Oh OK, you are right -- when I deploy the report, my code does work! Thank you very much.

You'd think there would be ONE mention of this little fact in SOME documentation, somewhere! It never would have occurred to me that the error was occurring only on preview.

In the SQL Server books online, the following is the entire entry for How to Add Code to a Report:

1. On the Report menu, click Report Properties.

Note: If the Report menu is not available, click within the report design area.

2. On the Code tab, in Custom code, type the code.

I kid you not. Anyway, thank you very much!

Embedded code: what's the trick?

I am trying to put some embedded Visual Basic code into my report (RS 2005), using the "Code" section in the report properties.

Here's the function I'm trying to use:

Public Shared Function ReportTotal(ByVal IsUnitCost As Boolean,ByVal TotalDirectCosts As Double, ByVal SalaryBenefitsTotal As Double, ByVal IndirectRate As Double, ByVal SS_Screened As Integer, ByVal UnitRate As Double) As Double
If IsUnitCost Then
Return SS_Screened * UnitRate
Else
Return TotalDirectCosts + SalaryBenefitsTotal * IndirectRate
End If
End Function

Supposedly, after entering this you can access it in the expression for a field by typing the following: =Code.ReportTotal(... parameters ...)

However, when I try this, "ReportTalk" does not show up in the intellisense after I type "Code.". If I type it in anyway, a red squiggly line shows up under it, and if I attempt to preview the report, I get the following error: "The definition of report [report name] is invalid. Exception of type 'Microsoft.ReportingServices.ReportProcessing.ReportProcessingException' was thrown."

This is not a very helpful error message! I tried with and without "Public" and "Shared" and got the same thing.

What am I doing wrong?


Unfortunately, Custom code is not compiled until the report is published, so any custom methods will not show up in intellisense or be resolved (which results in the red underline) by the report designer.

If you are using RS 2005, then it should be evident in the exception message if the custom code generated the error. So, inorder to help you debug the issue I have a few questions:
What version of Reporting Services are you using?|||

Oh OK, you are right -- when I deploy the report, my code does work! Thank you very much.

You'd think there would be ONE mention of this little fact in SOME documentation, somewhere! It never would have occurred to me that the error was occurring only on preview.

In the SQL Server books online, the following is the entire entry for How to Add Code to a Report:

1. On the Report menu, click Report Properties.

Note: If the Report menu is not available, click within the report design area.

2. On the Code tab, in Custom code, type the code.

I kid you not. Anyway, thank you very much!

Wednesday, March 7, 2012

EM file is corrupted

I tried to install Visual Studio 2005 and I corrupted my EM file. Now if I
try to open EM it tells me that the file is not available or was created
with newer version of EM.
What can I do about it?
thank
Shimon.I resolved it. Let me know if you are interested how I did it.
Shimon.
"Shimon Sim" <estshim@.att.net> wrote in message
news:eKodAwGXFHA.160@.TK2MSFTNGP15.phx.gbl...
>I tried to install Visual Studio 2005 and I corrupted my EM file. Now if I
>try to open EM it tells me that the file is not available or was created
>with newer version of EM.
> What can I do about it?
> thank
> Shimon.
>

EM file is corrupted

I tried to install Visual Studio 2005 and I corrupted my EM file. Now if I
try to open EM it tells me that the file is not available or was created
with newer version of EM.
What can I do about it?
thank
Shimon.
I resolved it. Let me know if you are interested how I did it.
Shimon.
"Shimon Sim" <estshim@.att.net> wrote in message
news:eKodAwGXFHA.160@.TK2MSFTNGP15.phx.gbl...
>I tried to install Visual Studio 2005 and I corrupted my EM file. Now if I
>try to open EM it tells me that the file is not available or was created
>with newer version of EM.
> What can I do about it?
> thank
> Shimon.
>

EM file is corrupted

I tried to install Visual Studio 2005 and I corrupted my EM file. Now if I
try to open EM it tells me that the file is not available or was created
with newer version of EM.
What can I do about it?
thank
Shimon.I resolved it. Let me know if you are interested how I did it.
Shimon.
"Shimon Sim" <estshim@.att.net> wrote in message
news:eKodAwGXFHA.160@.TK2MSFTNGP15.phx.gbl...
>I tried to install Visual Studio 2005 and I corrupted my EM file. Now if I
>try to open EM it tells me that the file is not available or was created
>with newer version of EM.
> What can I do about it?
> thank
> Shimon.
>

Wednesday, February 15, 2012

Editing Stored Procedures

Probably the wrong NG, but I can't find one for Visual Studio.
How are you supposed to edit SP's in VS 2003? I cannot find the option
anywhere. I can do it from Query Analyzer simply enough, but flipping back
and forth is a pain.
Hi Rock,
In Visual Studio 2003, you can create and edit a stored procedure via the
following steps:
1. Click View menu and select "Server Explorer";
2. Right click "Data Connections", click "Add Connection...", in the "Data
Link Properties" window, input the server name and select the database;
3. Expand the database connection "<server name>.<database name>.dbo",
expand "Stored Procedures", double click the stored procedure for browsing
or editing. If you want to create a new stored procedure, just right click
"Stored Procedures" and click "New Stored Procedure".
Hope this helps. If you have any other questions or concerns, please feel
free to let me know. It is my pleasure to be of assistance.
Best regards,
Charles Wang
Microsoft Online Community Support
================================================== ===
When responding to posts, please "Reply to Group" via
your newsreader so that others may learn and benefit
from this issue.
================================================== ====
This posting is provided "AS IS" with no warranties, and confers no rights.
================================================== ====

Editing Stored Procedures

Probably the wrong NG, but I can't find one for Visual Studio.
How are you supposed to edit SP's in VS 2003? I cannot find the option
anywhere. I can do it from Query Analyzer simply enough, but flipping back
and forth is a pain.Hi Rock,
In Visual Studio 2003, you can create and edit a stored procedure via the
following steps:
1. Click View menu and select "Server Explorer";
2. Right click "Data Connections", click "Add Connection...", in the "Data
Link Properties" window, input the server name and select the database;
3. Expand the database connection "<server name>.<database name>.dbo",
expand "Stored Procedures", double click the stored procedure for browsing
or editing. If you want to create a new stored procedure, just right click
"Stored Procedures" and click "New Stored Procedure".
Hope this helps. If you have any other questions or concerns, please feel
free to let me know. It is my pleasure to be of assistance.
Best regards,
Charles Wang
Microsoft Online Community Support
========================================
=============
When responding to posts, please "Reply to Group" via
your newsreader so that others may learn and benefit
from this issue.
========================================
==============
This posting is provided "AS IS" with no warranties, and confers no rights.
========================================
==============

Editing Stored Procedures

Probably the wrong NG, but I can't find one for Visual Studio.
How are you supposed to edit SP's in VS 2003? I cannot find the option
anywhere. I can do it from Query Analyzer simply enough, but flipping back
and forth is a pain.Hi Rock,
In Visual Studio 2003, you can create and edit a stored procedure via the
following steps:
1. Click View menu and select "Server Explorer";
2. Right click "Data Connections", click "Add Connection...", in the "Data
Link Properties" window, input the server name and select the database;
3. Expand the database connection "<server name>.<database name>.dbo",
expand "Stored Procedures", double click the stored procedure for browsing
or editing. If you want to create a new stored procedure, just right click
"Stored Procedures" and click "New Stored Procedure".
Hope this helps. If you have any other questions or concerns, please feel
free to let me know. It is my pleasure to be of assistance.
Best regards,
Charles Wang
Microsoft Online Community Support
=====================================================When responding to posts, please "Reply to Group" via
your newsreader so that others may learn and benefit
from this issue.
======================================================This posting is provided "AS IS" with no warranties, and confers no rights.
======================================================