RS Custom Code (Permission Errors)

Feb 1, 2008

I created some custom code that will check to see if a file exists on a Windows Share.



Code Snippet
Public Function FileExists(ByVal FileFullPath As String) As Boolean
Try
Dim f As New System.IO.FileInfo(FileFullPath)
Return f.Exists
Catch e As Exception
Return e.Description
End Try
End Function





An example of what I am passing is this:



Code Snippet
\servernamesharenamefilename.txt





I use this code in a TextBox on my Report:



Code Snippet
=IIF(Code.FileExists(Fields!OutPutFileName.Value) = TRUE,"True","False")





I get this error in my report:



Code SnippetSystem.Security.SecurityException: Request for the permission of type 'System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
at System.Security.CodeAccessSecurityEngine.Check(Object demand, StackCrawlMark& stackMark, Boolean isPermSet)
at System.Security.CodeAccessPermission.Demand()
at System.IO.FileInfo..ctor(String fileName)
at ReportExprHostImpl.CustomCodeProxy.FileExists(String FileFullPath)
The action that failed was:
Demand
The type of the first permission that failed was:
System.Security.Permissions.FileIOPermission
The Zone of the assembly that failed was:
MyComputer




BUT it works on my local machine. Any Ideas?

View 3 Replies


ADVERTISEMENT

Connection String And Permission Errors In The CLR Code

Feb 28, 2008

I have written a CLR function in C# to access a sql server different from the current server where I have deplyed the assembly.


DataSet ds = new DataSet();





SqlCommand sqlCmd = new SqlCommand();

sqlCmd.CommandType = CommandType.StoredProcedure;

string connString = "Data Source=SQLSERVER;Initial Catalog=DATABASE;User ID=userid;Password=password;";

SqlConnection sqlConn = new SqlConnection(connString);

sqlCmd.Connection = sqlConn;

sqlConn.Open();

try

{

SqlDataAdapter sda = new SqlDataAdapter();

sqlCmd.CommandText = "StoredProcedureName";

sqlCmd.Parameters.Add("@Param1", SqlDbType.VarChar);

sqlCmd.Parameters["@Param1"].Value = sParam1;

sda.SelectCommand = sqlCmd;

sda.Fill(ds);

}

finally

{

sqlConn.Close();

}

return ds;

I was getting the following error

"Request for the permission of type 'System.Data.SqlClient.SqlClientPermission, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed."

so I tried doing the following


SqlClientPermission pSql = new SqlClientPermission(System.Security.Permissions.PermissionState.Unrestricted);

pSql.Assert();



and then I get this error


"Request for the permission of type 'System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed."


Any idea how to remedy this ?

Thanks in advance
- Kan

View 4 Replies View Related

Custom Code (Embedded Code) Question

Oct 16, 2007



Hi all,

Could someone tell me if custom code function can capture the event caused by a user? For example, onclick event on the rendered report?

Also, can custom code function alter the parameters of the report, or refresh the report?

Thanks.

View 2 Replies View Related

SELECT Permission Was Denied Errors

Apr 27, 2009

I am trying to set up a DotNetNuke installation on Windows XP with IIS 5.1 and MSSQL Server Express 2008. I have checked the permissions on the account trying to access the database and everything is checked. However I keept getting the error, do I need to make ever user in the database an admin to edit and do everything to the database?

Code is Below:

Code:
Index #: 0
Source: .Net SqlClient Data Provider
Class: 14
Number: 229
Message: The SELECT permission was denied on the object 'sysobjects', database 'mssqlsystemresource', schema 'sys'.

[code]...

View 2 Replies View Related

Getting Permission Errors On Using Webclient In CLR Stored Procedure.

Jan 11, 2008

 Hello,I have a CLR stored procedure which send some values to an external URL by using the webclient, but for some reason I am getting this error.A .NET Framework error occurred during execution of user-defined routine or
aggregate "sp_LeadSend": System.Security.SecurityException: Request for
the permission of type 'System.Net.WebPermission, System, Version=2.0.0.0,
Culture=neutral, PublicKeyToken=b77a5c561934e089' failed.
System.Security.SecurityException: at System.Net.WebClient.UploadValues can anyone please advice how to resolve this one...I am really having a hard luck....... thanks.  

View 2 Replies View Related

Custom Errors

Jan 18, 2007

Hi,

I am showing my report in the web application using Report Viewer control.In the report i have start date and End date parameters.While running the report if i give startdate as '45/66/20007' it is displaying a message which is not user friendly.Is there is any way we can handle this type of errors and display our own custom error messages.

Thanks in advance

View 8 Replies View Related

SqlDataSource Custom SQL Statement Vs Stored Procedure Permission Problem

May 8, 2008

PLEASE PLEASE PLEASE......
I did not get a single response for the last 6 hours... And during this time I was searching and trying to understand the problem but I am really stuck. If this is the wrong forum to ask this question, please redirect me. Really begging for replies...[:'(]
If I use the custom SQL statements in SqlDataSource, the application runs fine within the development environment (VS2005) but errors out if I publish the web site and access outside of the environment. In order to find-out the problem, I made the following test:
I created a select statement in one SqlDataSource to fill-in a GridView. I used the exact same statement to create a stored procedure and used that SP in second SqlDataSource and I fill a second GridView. When I debug or run the application, both grids are filled OK and everything works fine. However, when I publish the web site and try to do same only the stored procedure works fine and when I try to fill the grid using the built-in SQL, the page gives error. The error mesage is as follows when I use the address 'localhost':
Server Error in '/' Application.


The SELECT permission was denied on the object 'Contacts', database 'Homer', schema 'dbo'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Data.SqlClient.SqlException: The SELECT permission was denied on the object 'Contacts', database 'Homer', schema 'dbo'.Source Error:



An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. Stack Trace:



[SqlException (0x80131904): The SELECT permission was denied on the object 'Contacts', database 'Homer', schema 'dbo'.]
System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) +859322.......da da da .......
If I access the page using the IP address the message chages to below but it is not the issue, I just give it if it helps to find the problem:
Server Error in '/' Application.


Runtime Error
Description: An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine. Details: To enable the details of this specific error message to be viewable on remote machines, please create a <customErrors> tag within a "web.config" configuration file located in the root directory of the current web application. This <customErrors> tag should then have its "mode" attribute set to "Off". 
My SqlDataSource s are like this: <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:HomerConnectionString %>"
SelectCommand="TestRemoteAccess" SelectCommandType="StoredProcedure">
<SelectParameters>
<asp:ControlParameter ControlID="TextBox1" Name="Param1" PropertyName="Text" Type="Int32" />
</SelectParameters>
</asp:SqlDataSource>
<asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:HomerConnectionString %>"
SelectCommand="SELECT FirstName, LastName, Business FROM Contacts WHERE (ContactID = @Param1)">
<SelectParameters>
<asp:ControlParameter ControlID="TextBox2" Name="Param1" PropertyName="Text" />
</SelectParameters>
</asp:SqlDataSource>

 
 Environment: SQL Server 2005, VS2005, Vista
 

View 1 Replies View Related

SQL Server Custom Errors?

Jun 22, 2006

I have a web application with a sql server 2000 backend. I use stored procedures to enter data, and use the sql RAISEERROR function to raise custom errors with the input.
My question is, is there anyway I can assign a number to these error and then catch them in my code?
 
e.g. I have an asset. Someone has authorised an inspection to occur on it. Now, they cannot authorise two inpsections - they must wait for one of the inspections to occur. I catch when someone is trying to authorise two inspections in the database, and raise an error.
But I then want my code to catch this error message and display a user friendly message to the user. Is there a way of attaching a number to the message so that I can catch it in my code and display an appropriate message?

View 1 Replies View Related

Errors With Custom Task (Could Not Get Value For Property ...)

Jul 5, 2007

I wrote a custom task following the outline on MSDN. I signed it and installed it into the Tasks folder and in the GAC.

When I go to an SSIS project and add my task, the properties window shows "Could not get value for property 'd61935d9-430b-4c93-9f3e-a29f720d8659'. Specified cast is not valid." (where the guid is different obviously) for many of the properties.

What have I done wrong?

Update: I know this isn't my code because I tried a simple task that just returns success and doesn't do anything. I get the exact same errors, so I must be installing it incorrectly.

View 3 Replies View Related

RS 2000 - Can't Start Report Manager / Permission Errors / Need To Update Data Source

Jul 5, 2007

We are going insane trying to start Report Manager on a SQL Reporting Services 2000 installation. The programmer/admin who originally set this up for us is gone.



We recently upgraded a database/application server to a new server, causing the data source being used by reports in reporting services to no longer be valid. Unfortunately, we do not have access to the original report project to 're-deploy' with the corrected data source.



We desperately need to get the reports that are installed to retrieve their data from the new database location/machine. We understand this can be done by specifying a new data source in Report Manager. (To clarify, we have NOT moved the report servier installation or database, these remain in place - it's just the deployed reports that no longer point to the correct data source.)



For some reason, our Report Manager will no longer run - when we try to launch it, we get a windows login dialog - nothing will work here. We've tried both local and domain admins and constantly get ACCESS IS DENIED 401.3 error messages that we do not have permission/problems with ACL's.



We've gone so far as to allow EVERYONE read/write access to the ReportManager and ReportServer folders and the RS virtual directories, but nothing seems to help.



Can anyone help with this? Ideas on how to change our data source, or how to get back into Report Manager?



Since we are somewhat technical, but not experts, and don't have much more time to waste, we are willing to pay $500 for this project to someone willing to access the server and fix the problem so that the reports point to the correct database and restore access to Report Manager.



Thanks in advance for any help.

View 1 Replies View Related

Using Custom Code

May 17, 2007

I am trying to use custom code on a report which is:



Public Function Percentage(decValueOne As Double, decValueTwo As Double) As Object

If (decValueOne = 0 Or decValueTwo = 0) Then
Percentage = 0
Else
Percentage = (decValueOne - decValueTwo)
End If

End Function



In my textbox I have:

=Code.Percentage(SUM(Fields!PreviousYTDExpenseAmount.Value, "Template_OutputData_Sales"), SUM(Fields!PreviousYTDExpenseAmount.Value, "Template_OutputData_CGS"))



When I run the report in design mode, I get the "#Error" on that report field.



Any help with why this is happening would be greatly appreciated!

View 2 Replies View Related

Custom Code....

Mar 21, 2007

Hey guys I have a problem I am trying to solve using custom code but I am open to other solutions.

Situation: I have multiple reports that the user can see. Example (Move In Corp. report, Move In Region report,Move In Division report, Mid Year Corp. report, Mid Year Region report,Mid Year Division report etc.) I have a stored procedure that returns all the information needed based upon the UserID being passed from the report to the stored procedure.

Goal: When the user logs in I want to be able to foward the user to a specific report based upon their userid (global in RS). I currently have three textboxes(Move In, Mid Year, Year End) with navigation enabled to jump to another report. The report to which the user is passed to is determined by an expression which is something like this for the Move In text box =IIF(Fields!orgtypeid.Value = 1,"Move In Corp","Move In Region"). The orgtypeid.value is returned by the stored procedure. I want to be able to forward the user a specific Move In report (Move In Corp, Move In Region, etc) without having the user select the textbox.



Any suggestions are greatly appreciated.

View 3 Replies View Related

Custom Code

Oct 24, 2007



Hello, this is probably a pretty easy one. I have made a report, and added custom code in the code tab on the report properties. But when I type code.whatever in a text box expression my function does not show. Does anyone know what I am doing wrong?

Thanks

View 3 Replies View Related

Errors In Code

May 14, 2007

set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
go

/*************************************************************************************
Description: This store procedure is used to return the district's Rubric Report.
Returns:
RubricReport.ReportID
RubricReport.LastUpdate
RubricReport.LastUpdateBy
RubricReportDetail.LocalPerf
RubricReportDetail.GoalMet
RubricReportTemplate.IndicatorNumber
RubricReportTemplate.Topic
RubricReportTemplate.Part
RubricReportTemplate.ILCDComponent
SppTarget.Target
Parameters:
@DataYears
@County
@District
@LastUpdateBy

*/
ALTER PROCEDURE [dbo].[usp_RubricReportGet]
-- Add the parameters for the stored procedure here
@DataYears CHAR(8),
@County CHAR(2),
@District CHAR(4),
@LastUpdateby VARCHAR(50),
@ReportID INT,
@LastUpdate SMALLDATETIME,
@IndicatorID TINYINT,
@IndicatorNumber VARCHAR(5),
@Number VARCHAR(20),
@FYY CHAR(9),
@Part CHAR(1),
@Years CHAR(8),
@maxLastUpdate SMALLDATETIME,
@LocalPerf DECIMAL(5,4),
@GoalMet BIT,
@Topic VARCHAR(100),
@ILCDComponent VARCHAR(50)


AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from

SET NOCOUNT ON;

-- Get the ReportID and LastUpdate values from Rubric Report Table matching
-- County=@County and District=@District
SELECT ReportID, LastUpdate
FROM RubricReport
WHERE (RubricReport.County = @County) AND (RubricReport.District = @District) AND (RubricReport.DataYears = @DataYears)

-- With table SPPIndicator and SppIndicator11Data, find the maximum value of LastUpdate (@maxLastUpdate)
SELECT @maxLastUpdate FROM (SELECT LastUpdate FROM SPPIndicator UNION ALL SELECT LastUpdate FROM SppIndicator11) AS D


IF @maxLastUpdate > (SELECT LastUpdate FROM RubricReport WHERE (RubricReport.County = @County) AND (RubricReport.District = @District) AND (RubricReport.DataYears = @DataYears))
BEGIN
EXEC usp_RubricReportCalc @DataYears, @County, @District, @LastUpdateBy
END

ELSE

SELECT ReportID, LastUpdate, LastUpdateBy
FROM RubricReport
WHERE RubricReport.ReportID = RubricReportDetail.ReportID

SELECT IndicatorNumber, Topic, Part, ILCDComponent
FROM RubricReportTemplate
WHERE RubricReportDetail.IndicatorID = RubricReportTemplate.IndicatorID


SELECT LocalPerf, GoalMet
FROM RubricReportDetail
WHERE SppTarget.IndicatorNumber = RubricReportDetail.IndicatorID

SELECT Target
FROM SppTarget
WHERE SppTarget.Years = @DataYears

END


I have the above created stored proc. which gives the following errors:

Msg 107, Level 16, State 3, Procedure usp_RubricReportGet, Line 69
The column prefix 'RubricReportDetail' does not match with a table name or alias name used in the query.
Msg 107, Level 16, State 3, Procedure usp_RubricReportGet, Line 73
The column prefix 'RubricReportDetail' does not match with a table name or alias name used in the query.
Msg 107, Level 16, State 3, Procedure usp_RubricReportGet, Line 78
The column prefix 'SppTarget' does not match with a table name or alias name used in the query.


How can I resolve these erros?

View 8 Replies View Related

SQL Code Errors Please Help

Dec 12, 2007

SELECT CUSTNO Customer , ORDERNO Order , O_DATE Order Date

FROM cust_order

WHERE O_DATE = 10-20-03 AND EMPO= '%4'

ORDER BY ORDERNO;

please can anybody identify 4 errors

View 5 Replies View Related

What Custom Code Can Access

Jun 8, 2007

I am trying to find ways around the limitation of not being able to resize columns based on the text input. I am dynamically setting what values a column is getting from my query. I am wondering if I can access the table (and thus, the columns) from within the custom code.

For example:

Public Function Whynot() As Integer
Report.table1.TableColumn1.Width = ....
table1.TableColumn.Width = ....
Return 0
End Function

Neither of these seem to work, anyone else have any ideas?

Thanks

View 2 Replies View Related

Is It Possible To Do A Redirect In The Custom Code?

Jun 11, 2007

Is it possible to do a redirect to an arbitrary page in by using custom code?



eg.



Public sub myRedirect()

response.redirect(http://www.microsoft.com)

End sub



/Alex

View 1 Replies View Related

Custom Code Question

Feb 21, 2008

I developed a ConnectionString assembly in custom code a while back. Now it won't work. I've changed boxes since. My question is do I have to have SQL Server and Reporting Services on my development machine to run Custom Code assemblies?

I put my dll in the PublicAssemblies folder. I see that I need to put my dll in C:Program FilesMicrosoft SQL Server80ToolsReport Designer but I don't have that folder.

When I try and set the ConnectionString to "=ReportingLibrary.ReportingLibraryFunctions.ConnectionString(User!UserID)", I get "Unrecognized Identifier." I checked the reference and it was still there from when the project was working before.





Code Snippet
using System;
using System.Security.Permissions;
using System.Configuration;
namespace ReportingLibrary
{

public class ReportingLibraryFunctions
{

public static string ConnectionString(string userName)
{

System.Data.SqlClient.SqlClientPermission oPerm = new System.Data.SqlClient.SqlClientPermission(PermissionState.Unrestricted);
oPerm.Assert();
string catalog;
string query;
string connectstring;
string datasrc = String.Format("Data Source={0};", ConfigurationManager.AppSettings["DataSource"]);
string userpwd = String.Format("User ID={0};Password={1};", ConfigurationManager.AppSettings["DBUsr"], ConfigurationManager.AppSettings["DBPwd"]);
query = "SELECT TOP 1 MyAcctKey FROM dbo.MyUserAcct WHERE UserName=@username;";
connectstring = String.Format("{0}Initial Catalog=MyMaster;", datasrc);
System.Data.SqlClient.SqlConnection connection = new System.Data.SqlClient.SqlConnection(String.Format("{0}{1}", datasrc, userpwd));
connection.Open();
System.Data.SqlClient.SqlCommand command = new System.Data.SqlClient.SqlCommand(query, connection);
command.Parameters.Add("@username", System.Data.SqlDbType.VarChar);
command.Parameters["@username"].Value = userName;
catalog = String.Format("MyDb_{0};", command.ExecuteScalar());
connectstring = String.Format("{0}Initial Catalog={1}", datasrc, catalog);
connection.Close();
return connectstring;
}
}
}

View 9 Replies View Related

Writing A Custom Code Example

Oct 19, 2007


I have been stuck in a problem for a while now. I am trying to count the number of groups. I tried soo many things and nothing worked . Now I want to try to write a function that does the counting for me.

Can somebody write me an example of a cutom code that can be called from expression.
So my custome code should be something like that

Public int CountFun(int counter)
{
Return counter= counter +1;

}

Also how do I call this method from my expression?
i am going to call it from a field inside the groups, so each time the group is implemented i add one to the counter.

thanks

View 4 Replies View Related

Nested Ifs In Custom Code

Sep 19, 2007

Is it not possible to have nested ifs in a custom code function? I keep getting an error message when I try it.

View 1 Replies View Related

Custom Code For A Parameter

Oct 3, 2006

I'm using a GAC-installed assembly as part of a Reporting Services
(2005) report. The code does not need any permissions beyond execution.
All it does it take today's date and calculate last week's start and
end date. It's all just datetime manipulations. All methods are static.

In
the VS2005 report designer, I can do everything fine. The code runs as
expected and defaults the parameters to the right date.

When I
upload the rdl to the Report Server, I get the message "Error during
processing of €˜Start€™ report parameter.
(rsReportParameterProcessingError) ". If I override the "Start"
parameter, it doesn't give me that error anymore. Start should be the
Sunday of the previous week.

I have deployed the signed assembly to the GAC on the report server as well as the bin folder for reporting services. Because it doesn't need anything beyond execution, I shouldn't have to modify any config files, right? I have already restarted IIS & the Reporting Services service.

What am I missing?

View 10 Replies View Related

Grouping And Custom Code

Jun 25, 2007

Hello everyone,



I've got an issue where I want to sum the group values and not the details, the reason is because I am hiding duplicate records. Here's how my Layout is setup.




TH

GH1 (hidden)

GH2 (hidden)

Det (hidden)

GF2 =Code.AddValue(Fields!Quantity.Value * Fieds!Cost.Value)

GF1 =Code.ShowAndResetSubTotal()

TF =Code.GrandTotal



I have the following in my Code window.




Dim Public SubTotal as Decimal

Dim Public GrandTotal as Decimal

Function ShowAndResetSubTotal() as Decimal

ShowAndResetSubTotal = SubTotal

SubTotal = 0

End Function

Function AddValue(newValue as decimal) as Decimal

SubTotal += newValue

GrandTotal += newValue

AddValue = newValue

End Function



This gives me incorrect results and I can't figure out why. Here's how it shows on my report:
















Part Number
Quantity

Cost
Regular Subtotal Method
Using Custom Code

Part 1
4,000

1.49
$5,947.20



Customer 1



$11,894.40
$0.00

Part 2
10

1.01
$10.07



Customer 2



$50.34
$5,947.20

Part 3
1

0.44
$0.44


Part 4
6,050

0.25
$1,530.41


Part 5
0

1.25
$0.00


Part 6
0

1.23
$0.00



Customer 3



$42,851.86
$10.07

Part 7
16,250

0.24
$3,922.59



Customer 4



$19,612.94
$1,530.85

Part 8
17,250

0.38
$6,544.82


Part 9
27,225

0.20
$5,380.20



Customer 5



$66,891.69
$3,922.59










Grand Total



$141,301.23
$0.00



The issues brought up from the duplicates is shown in the "Regular Subtotal Method" column (there are 2 detail records for Customer 1-Part 1, which is why it is doubled). I can't use a distinct on the SQL query because there are other fields (not shown) on the report that are different.



As you can see, the GF1 (Customer #) shows the subtotal from the previous group, and the Table Footer (Grand Total) shows 0. Why is this?



Jarret

View 2 Replies View Related

Bug With InScope() And Some Custom Code

May 30, 2006

Hi guys,

i was developing some custom code to do a running total in a matrix, and i have noticed some odd behaviour with the InScope function. I am doing year on year reporting, so i have two row groups on my matrix: the first is on month (matrix2_Calendar_Month), the second on year (matrix2_Calendar_Year).

I needed to total the number of days covered by the months i was reporting on, so i wrote some very standard code to do this, along with an expression in that column of the matrix:

=IIf(
 InScope("matrix2_Calendar_Year"),
 CStr( Round( Sum(Fields!Sales.Value / (24 * Code.AddDays( CStr(Fields!Calendar_Month.Value),  CInt(Fields!Calendar_Year.Value))), 2)) ,
 Code.getBounds()
)

Code.AddDays() calculates and returns the number of days in the month of that year on that row. Code.getBounds simply returns the lower and upper bounds of the array, plus its contents (so i can inspect them). This is what is returned in the report:

 













Month / Year

Sales

Capacity

% Capacity

Avg $/h



February

2006

3842

7706

49.86%

2.86



2007

0

0

0.00%

0



March

2006

4949

8692

56.94%

3.33



2007

0

0

0.00%

0



April

2006

5160

8154

63.28%

3.58



2007

0

0

0.00%

0



May

2006

3309

8348

39.64%

2.22



2007

0

0

0.00%

0



Total

17259

32900

52.46%

0-8*28,28,31,31,30,30,31,31,28

 

If you look at the output in the total row, you will see that Code.AddDays() has been called one extra time at the end,  with Feb 2006 as its parameters, thus adding an extra 28 days to the running total. Why is Code.AddDays called on the total row, when i should be out of the scope of both the row groups? (Note: this happens for whichever row group i use in the InScope check in the expression).

Here is the custom code used for all this:

Dim numDays()

Public Function AddDays(ByVal month As String, ByVal year As Integer) As Integer
    Dim thisMonth As String
   
    Dim upper As Integer
    upper = 0
    On Error Resume Next
    upper = UBound(numDays) + 1
    ReDim Preserve numDays(upper)
       
    thisMonth = CStr(year) & "-" & month & "-01"
    numDays(upper) = DateDiff("d", CDate(thisMonth), DateAdd("m", 1, CDate(thisMonth)))
    AddDays = numDays(upper)
End Function

Public Function TotalDays() As Integer
    Dim lower As Integer
    Dim upper As Integer
   
    lower = 0
    upper = 0
    On Error Resume Next
    lower = LBound(numDays)
    upper = UBound(numDays)
   
    TotalDays = 0
    Dim ii As Integer
    For ii = lower To upper  
        TotalDays = TotalDays + CInt(numDays(ii))
    Next
End Function

public function getBounds() as string
 getBounds = Cstr(LBound(numDays)) & "-" & CStr(UBound(numDays)) & "*" & Join(numDays, ",")
end function

 

sluggy

 

 

View 5 Replies View Related

Custom Code Spaces Being Cut Off

May 6, 2008

I have a custom C# assembly that my report is calling with embedded code that is called from fields in a reporting services table. The value comes back fine, but I need some of the values to be indented, so I have tried all of the following and every time the spaces are cut off. Spaces work when not using embedded code.

I tried the following in the table cell
=Space(3)+Code.<<String Function Name>>
and I tried
=" "+Code.<<String Function Name>>

Then I tried the code in the assembly and in the embedded code with the same result. No matter where I put the spaces they get cut off. Any ideas? I tried characters other than spaces and they came back fine.

Thanks,
Adam

View 5 Replies View Related

How Do You Account For Errors In SQL Code?

Jan 7, 2005

Hi everyone,

I have a form that is being used by a user, and the form is writing to an sql database, but it gets the "string or binary data would be truncated, the statement has been terminated" error. I realize that this is due to the fact that he filled out a an entry where the respective column length was shorter than what he put in...

I am curious as to how you account for this? What is the industry practice? Is it better to truncate? Make the database columns a huge size? Put in validators for every single control to make sure that the space is an acceptable length? How do you guys account for things that might go wrong when writing to SQL?

Try, Get's?

I am confused as to how to even approach this sort of thing...

Thanks,

View 1 Replies View Related

Errors In Function Code

Feb 2, 2007

Hi,

I'm pretty new to SQL and I'm having trouble with a function, probably just syntax. I'm trying to consolidate several rows of data into a single row text field.
The calling program can use views but not functions so I need to get a table into a view with the consolidated lines.

Also, I would think this could be consolidated to a single view that calls one function. Is that possible, how would I do it?

Thanks for any help,
Steve


VIEW WHERE DATA COMES FROM:
CUST_ORDER_ID | LINE_TEXT
number1 | first line item text
number1 | Second line item text
number1 | Third line item text
number2 | first line item text
number2 | Second line item text
...


VIEW I WANT:
CUST_ORDER_ID | CO_LINES_TEXT
number1 | Second line item text 'crlf' Third Line item text
number2 | Second line item text


FUNCTION CODE: This is the function code with errors

CREATE FUNCTION dbo.tvf_NC_CO_LINES_TEXT (@ORDER_ID VARCHAR(20))

RETURNS @NC_CO_LINES TABLE
(
CUST_ORDER_ID VARCHAR(20) PRIMARY KEY NOT NULL,
CO_LINES_TEXT VARCHAR(1000) NULL
)
AS
BEGIN
DECLARE @COLinesString VARCHAR(1000);
SET @ORDER_ID = CUST_ORDER_ID;
SELECT @COLinesString = COALESCE(@COLinesString + Char(13) + Char(10), '') + LINE_STRING
FROM NC_CO_LINES_STRING
WHERE NC_CO_LINES_STRING.CUST_ORDER_ID = @ORDER_ID
SET @COLinesString = CO_LINES_TEXT
RETURN
END;

GO


ERROR MESSAGES:
Msg 207, Level 16, State 1, Procedure tvf_NC_CO_LINES_TEXT, Line 16
Invalid column name 'CUST_ORDER_ID'.
Msg 207, Level 16, State 1, Procedure tvf_NC_CO_LINES_TEXT, Line 20
Invalid column name 'CO_LINES_TEXT'.


VIEW CODE:
SELECT dbo.CUST_ORDER_LINE.CUST_ORDER_ID, CAST(CAST(dbo.CUST_ORDER_LINE.ORDER_QTY AS INT) AS VARCHAR(2))
+ ' ' + dbo.CUST_ORDER_LINE.PART_ID + ' ' + dbo.PART.DESCRIPTION AS LINE_STRING
FROM dbo.CUST_ORDER_LINE INNER JOIN
dbo.PART ON dbo.CUST_ORDER_LINE.PART_ID = dbo.PART.ID
WHERE (dbo.CUST_ORDER_LINE.LINE_NO > 1)

Steve Bermes
Novae Corp.

View 2 Replies View Related

Getting Code Page Errors....

Feb 9, 2006

I am importing some data from my IBM DB2 Z/OS mainframe to SQL Server 2005 using the SSIS import wizard. The wizard automatically converted the DB2 string data before trying to store it to SQL Server. The code page that the wizard chose to do its conversion is the 1252 Ansi Latin. However, I am getting the following error on the address field...."one or more characters had no match in the target code page". Can someone suggest another code page? ASCII? IBM 37?

View 3 Replies View Related

Build Errors With The Code!!

Apr 9, 2007

Hi,

I'm new to SQL Server RS.

I'm getting build errors after writing the following code:

List<ReportParameter> reportParam = new List<ReportParameter>(); reportParam.Add(new ReportParameter("Database", connectionString)); reportParam.Add(new ReportParameter("master_dept", hidMasterDept.Value.ToString().Trim())); reportParam.Add(new ReportParameter("station_id", hidStationId.Value.ToString().Trim())); reportViewer.ServerReport.SetParameters(reportParam)

The error message is as follows:
No overload for method 'ReportParameter' takes '2' arguments

But when I build the page using "Build Page" command from the menu, it builds successfully and then the project build succeeds.

When I modify any other page and build the solution, the same build error for this page occurs again.

Any idea how to resolve this? Been spending a lot of time figuring this out.

Thanks in Advance,

Manjunath HK

View 5 Replies View Related

Correct Approach To Catching Execution Time Errors In A Custom Task

Jul 12, 2006

Hi,

I'm building a custom task and just wondering what is the correct way of passing errors back to SSIS. Is there a rcommended approach to doing this. Currently I just wrap everything in a TRY...CATCH and use componentEvents to fire it back! Here's my code:

public override DTSExecResult Execute(Connections connections, VariableDispenser variableDispenser,IDTSComponentEvents componentEvents, IDTSLogging log, object transaction)
{
 bool failed = false;
 try
 {
  /*
  * do stuff in here
  */
 }
 catch (Exception e)
 {
  componentEvents.FireError(-1, "", e.Message, "", 0);
  failed = true;
 }
 if (failed)
 {
  return DTSExecResult.Failure;
 }
 else
 {
  return DTSExecResult.Success;
 }
}

 

Any comments?

 

-Jamie

 

View 5 Replies View Related

How Can I Throw A Custom Error Code?

Jun 26, 2006

I'm trying to run a DTS package, and cant find an easy direct way to run it.  It seems like the easiest solution would be to throw a custom error- then the server notices the error and runs a  custom job, and the custom job runs the DTS.  This is a roundabout way, but seems like it would be the simplest solution.Anyways, how do I throw the error in my code?  Do I just write a throw 3829 statement?  Also maybe this is a very bad way to do this- any suggestions?

View 2 Replies View Related

Custom Code...For The Sake Of Argument

Oct 3, 2006

Is it possible to write custom code that achieves the same thing as an aggregate function?

ex: Calculating the sum of a group? (with out using the sum( field!one.value) function)

if I had a group that grouped on name.


Name Number
header Fields!FirstName.Value ************
details Fields!Number.Value
footer

Can i write a custom code function (or functions) that will get the sume of the numbers in that group.

Thanks in advance.

View 7 Replies View Related

Execute Query Within Custom Code

Apr 2, 2008

Hi,
Is it possible to connect to a database and fetch data from it from within custom code inside a report?
Appreciate any help.

Regards,
Asim.

View 4 Replies View Related

Build Parameter From C#/Custom Code

Jun 6, 2007

Hello,

Is it possible to add a multivalued parameter to a report from C#? I already have a C# .dll which I reference in the report. If so, could someone give some hints on how to do it?

As I searched the net for an answer to this, I came across ReportExecutionService. It looks like it's what I want, but I cant find the dll to reference in order to used this class. Does anyone know?

If it is not possible to do this from C#, then can someone please give an example on how to do it from Custom Code?


Thanks
/Peter

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved