Custom Code access in a SQL Server report - sql-server

This is my first post to this forum.
I have a SQL Server report that I have developed some custom code to return some data that is calculated through another dll (The calculation is extensive so I didn't want to re-create it).
I 've referenced the code in the report and I'm able to call the method that returns the data on my local machine, however when I transfer the dll and the report to the reporting server I get the following message:
"Request for the permission of type 'System.Data.SqlClient.SqlClientPermission, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed."
I've tried creating a webservice, but the call failed just the same. From what I understand the rssrvpolicy.config on the report server requires an entry to give the dll permissions to execute. I have done this by adding the following entries with no luck:
<CodeGroup class="UnionCodeGroup" version="1" PermissionSetName="FullTrust" >
<IMembershipCondition class="UrlMembershipCondition" version="1" Url="d:\Program Files\Microsoft SQL Server\MSSQL.3\Reporting Services\ReportServer\bin\PerfCalcLib.dll" />
</CodeGroup>
<CodeGroup class="UnionCodeGroup" version="1" PermissionSetName="FullTrust" >
<IMembershipCondition class="UrlMembershipCondition" version="1" Url="d:\Program Files\Microsoft SQL Server\MSSQL.3\Reporting Services\ReportServer\bin\PerfCalcLibWrapper.dll" />
</CodeGroup>
Any ideas?
Thanks.

Just a thought. Did you try signing your assembly and deploying it to the GAC?

You can find resource at this http://msdn.microsoft.com/en-us/library/ms153561.aspx enough to get you started.

Related

SSMS error Microsoft.SqlServer.Management.SqlStudio...package did not load correctly, Microsoft.SqlServer.Management.IRegistrationService not found

I ran into a strange issue when I install SSMS v18.10 on my new work laptop (Win10 Pro Build 19042) with local Admin rights. I have tried both v18.10 and v18.9, uninstalled Extensions, etc. But none of them works. Can you please help? Thanks a lot.
The installation seems all good. But when launching SSMS, it prompts a warning message "The 'Microsoft.SqlServer.Management.SqlStudio.... package did not load correctly".
screenshot1
After ignored this warning, when connection to our Azure SQL Database, it then prompts an error "Service 'Microsoft.SqlServer.Management.IRegistrationService' not found (Microsoft.SqlServer.Management.SDK.SqlStudio)"
screenshot2
I also noticed under "Help" menu, there're two "About" items., one is "About SQL Server Management Studio", and the other is "About...". On my old work laptop, I only got one "About..." in my SSMS. When clicking "About...", I got the same warning message as when launching SSMS.
screenshot3
When click ""About SQL Server Management Studio", I got below information.
screenshot4
Perhaps you can try repairing SSMS via Apps & features (access by clicking windows button and typing app). When open, look for 'Microsoft SQL Server Management Studio - 18.10". Select Uninstall. It should give option for repairing.
I encountered this and found a strange solution. When checking the activity log (C:\Users\[username]\appdata\Roaming\Microsoft\AppEnv\15.0\ActivityLog.xml) I found the following:
<entry>
<record>61</record>
<time>2022/08/10 03:18:52.795</time>
<type>Error</type>
<source>VisualStudio</source>
<description>LegacySitePackage failed for package [Microsoft.SqlServer.Management.SqlStudio, Microsoft.SqlServer.Management.SqlStudio, Version=15.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91]Source: &apos;mscorlib&apos; Description: Could not find file &apos;C:\Users\[username]\Documents\SQL Server Management Studio&apos;.
System.IO.FileNotFoundException: Could not find file &apos;C:\Users\[username]\Documents\SQL Server Management Studio&apos;.
File name: &apos;C:\Users\[username]\Documents\SQL Server Management Studio&apos;
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.Directory.InternalCreateDirectory(String fullPath, String path, Object dirSecurityObj, Boolean checkHost)
at System.IO.Directory.InternalCreateDirectoryHelper(String path, Boolean checkHost)
at System.IO.Directory.CreateDirectory(String path)
at Microsoft.SqlServer.Management.SqlStudio.SetDefaultProjectOpenLocation()
at Microsoft.SqlServer.Management.SqlStudio.SetupInitialShellSettings()
at Microsoft.SqlServer.Management.SqlStudio.Initialize()
at Microsoft.VisualStudio.Shell.Package.Microsoft.VisualStudio.Shell.Interop.IVsPackage.SetSite(IServiceProvider sp)</description>
<guid>{04401FF3-8B0F-4D2D-85EB-2A3542867A8B}</guid>
<hr>80070002</hr>
<errorinfo></errorinfo>
And so, I created the following folder - C:\Users\[username]\Documents\SQL Server Management Studio - and that fixed the problem. ¯\_(ツ)_/¯

There is one error when I am trying to move TFS report to a new server

I try to debug a problem related to tfs report,I don't know why and really need help.
Recently I export one report from the old tfs server and deploy to the new server, I also copy the store procedures which related to this report in the old server database to the new server database.
But the report just doesn't work. The error is as following, The report rdl file and store processors in new tfs server are exactly same like the old server, just didn't work for the new one.
An error occurred during client rendering.
An error has occurred during report processing. (rsProcessingAborted)
Query execution failed for dataset 'DataSet1'.
(rsErrorExecutingCommand) Query (1, 16) Parser: The syntax for
'#TFS_Date' is incorrect.
First of all, I would suggest you to check your reporting service log files from below path,
C:\Program Files\Microsoft SQL Server\MSRS11.SQLEXPRESS\Reporting Services\LogFiles
Usually the error messages here in log file shows us a perfect solution.
In your case, try to check that user has access to dataset1's database. (server database) by going to SQL Server Security tabs.
Also, check your store procedure. If you have joined with some other database's table then user must have access of that database too.
Note: This type of error messages you can find there in log file. So read it to solve the issue.

Getting Detailed SSRS Errors

I have a report in SSRS (SSRS 2008, running on Windows 2008 Server, running in Sharepoint integrated mode) that is returning an error. However - I have no idea what the error is. If I run the report on the Report Server, I'm returned this error message.
Crystal clear, right?
I have enabled Remote Errors via Reporting Services, so I believe I can get the error by querying the ReportServer database by this:
SELECT * FROM ExecutionLogStorage
ORDER BY TimeStart DESC
I see the report I ran, but "Status" is "rsSuccess".
The AdditionalInfo field returns:
<AdditionalInfo>
<ProcessingEngine>2</ProcessingEngine>
<ScalabilityTime>
<Pagination>0</Pagination>
<Processing>0</Processing>
</ScalabilityTime>
<EstimatedMemoryUsageKB>
<Pagination>4</Pagination>
<Processing>18</Processing>
</EstimatedMemoryUsageKB>
<DataExtension>
<SQL>1</SQL>
</DataExtension>
</AdditionalInfo>
From that, it looks the report ran successfully, but it obviously didn't.
When I look through the SSRS logs, located here:
I see this:
library!ReportServer_0-9!abc!12/02/2013-13:52:47:: Call to GetPermissionsAction(http://ReportServer/reports/Documents/BlackList_Report.rdl).
library!ReportServer_0-9!11a4!12/02/2013-13:52:47:: Call to ListParentsAction(http://ReportServer/reports/Documents/BlackList_Report.rdl).
library!ReportServer_0-9!d54!12/02/2013-13:52:47:: Call to GetPermissionsAction(http://ReportServer/reports).
library!ReportServer_0-9!1c2c!12/02/2013-13:52:47:: Call to GetSystemPropertiesAction().
library!ReportServer_0-9!abc!12/02/2013-13:52:47:: Call to GetPermissionsAction(http://ReportServer/reports/Documents/BlackList_Report.rdl).
library!ReportServer_0-9!11b4!12/02/2013-13:52:48:: i INFO: RenderForNewSession('http://ReportServer/reports/Documents/BlackList_Report.rdl')
runningjobs!ReportServer_0-9!a70!12/02/2013-13:54:18:: i INFO: Adding: 1 running jobs to the database
Again, nothing that explains what the error is. How can I figure out what is causing this error?
Alright - I was able to configure Sharepoint to display the actual error. It has nothing to do with SSRS.
To get the full Sharepoint error, you need to make some changes in the web.config file, which is typically located in the following directory: c:\inetpub\wwwroot\wss\VirtualDirectories.
The changes you need to make are:
Find this entry:
<SafeMode MaxControls="200" CallStack="false" DirectFileDependencies="10" TotalFileDependencies="50" AllowPageLevelTrace="false">
and replace it with:
<SafeMode MaxControls="200" CallStack="true" DirectFileDependencies="10" TotalFileDependencies="50" AllowPageLevelTrace="true">
Lastly, change:<customErrors mode="On" /> to <customErrors mode="Off" />.
Save the file. I did not need to reboot Sharepoint for this to work.
Now Sharepoint should provide a detailed error message.

SSRS Query execution failed for dataset

Have just deployed my Project on to my reporting Server.
I have multiple datasets which are referencing views which exist on the db on that server.
When I try to go into any report part I am getting this message:
An error has occurred during report processing. (rsProcessingAborted)
Query execution failed for dataset 'dataset1'. (rsErrorExecutingCommand)
For more information about this error navigate to the report server on the local server machine, or enable remote errors
Can anyone help?
I enabled remote errors to pinpoint the problem.
I identified that a column in a particular dataset (one of my views) was throwing an error.
So using a tool "SQL Delta", I compared the development version of the database with the live version on the reporting server. I noticed that one of the views had an extra column on the development server, that was not on the live version of the db.
SQL Delta generated the script I needed to run to update the view on my live db.
I ran this script, re-ran the report, everything worked.
I encountered a similar error message. I was able to fix it without enabling remote errors.
In Report Builder 3.0, when I used the Run button to run the report, an error alert appeared, saying
An error has occurred during report processing. (rsProcessingAborted)
[OK] [Details...]
Pressing the details button gave me a text box where I saw this text:
For more information about this error navigate to the report server
on the local server machine, or enable remote errors
----------------------------
Query execution failed for dataset 'DataSet1'. (rsErrorExecutingCommand)
I was confused and frustrated, because my report did not have a dataset named 'DataSet1'. I even opened the .rdl file in a text editor to be sure. After a while, I noticed that there was more text in the text box below what I could read. The full error message was:
For more information about this error navigate to the report server
on the local server machine, or enable remote errors
----------------------------
Query execution failed for dataset 'DataSet1'. (rsErrorExecutingCommand)
----------------------------
The execution failed for the shared data set 'CustomerDetailsDataSet'.
(rsDataSetExecutionError)
----------------------------
An error has occurred during report processing. (rsProcessingAborted)
I did have a shared dataset named 'CustomerDetailsDataSet'. I opened the query (which was a full SQL query entered in text mode) in SQL Server Management Studio, and ran it there. I got error messages which clearly pointed to a certain table, where a column I had been using had been renamed and changed.
From that point, it was straightforward to modify my query so that it worked with the new column, then paste that modification into the shared dataset 'CustomerDetailsDataSet', and then nudge the report in Report Builder to recognise the change to the shared dataset.
After this fix, my reports no longer triggered this error.
Like many others here, I had the same error. In my case it was because the execute permission was denied on a stored procedure it used. It was resolved when the user associated with the data source was given that permission.
I experienced the same issue, it was related to security not being granted to part of the tables. review your user has access to the databases/ tables/views/functions etc used by the report.
The solution for me came from GShenanigan:
You'll need to check out your log files on the SSRS server for more detail. They'll be somewhere like: "C:\Program Files (x86)\Microsoft SQL Server\MSRS10_50.DEV\Reporting Services\LogFiles\"
I was able to find a permissions problem on a database table referenced by the view that was not the same one as the where the view was. I had been focused on permissions on the view's database so this helped pinpoint where the error was.
I just dealt with this same issue. Make sure your query lists the full source name, using no shortcuts. Visual Studio can recognize the shortcuts, but your reporting services application may not be able to recognize which tables your data should be coming from. Hope that helps.
I had the similar issue showing the error
For more information about this error navigate to the report server on
the local server machine, or enable remote errors Query execution
failed for dataset 'PrintInvoice'.
Solution:
1) The error may be with the dataset in some cases, you can always check if the dataset is populating the exact data you are expecting by going to the dataset properties and choosing 'Query Designer' and try 'Run', If you can successfully able to pull the fields you are expecting, then you can be sure that there isn't any problem with the dataset, which takes us to next solution.
2) Even though the error message says "Query Failed Execution for the dataset", another probable chances are with the datasource connection, make sure you have connected to the correct datasource that has the tables you need and you have permissions to access that datasource.
In my situation, I created a new SSRS report and new stored procedure for the dataset. I forgot to add the stored procedure to the database role that had permission to execute it. Once I added the permissions to SQL database role with EXECUTE, all was fine!
The error message encountered by the user was "An error occurred during client rendering. An error has occurred during report processing (rsProcessingAborted). Query execution failed for dataset "DataSet1'. (rsErrorExecutingCommand) For more information..."
Very grateful I found this great post. As for my case, the user executing the stored procedure did not have EXECUTE permissions. The solution was to grant EXECUTE permissions for the user within the stored procedure by adding below code to the end of the stored procedure.
GRANT EXECUTE ON dbo.StoredProcNameHere TO UsernameRunningreports
GO
I also had a very similar issue with a very similar error message. My issue was that the database could not be connected to. In our case, we have mirrored databases and the connection string did not specify the Failover Partner. So when the database couldn't connect, it never went to the mirror and was throwing this error. Once I specified the Failover Partner in the connection string for my datasource, it resolved the issue.
BIGHAP: A SIMPLE WORK AROUND FOR THIS ISSUE.
I ran into the same problem when working with SharePoint lists as the DataSource, and read the blogs above which were very helpful. I had made changes in both the DataSource and Data object names and query fields in Visual Studio and the query worked in visual Studio. I was able to deploy the report to SharePoint but when I tried to open it I received the same error.
I guessed that the issue was that I needed to redeploy both the DataSource and the DataSet to SharePoint so that that changes in the rendering tools were all synced.
I redeployed the DataSource, DataSet and the Report to sharePoint and it worked.
As one of the blogs stated, although visual studio allowed the changes I made in the dataset and datasource, if you have not set visual studio to automatically redeploy datasource and dataset when you deploy the report(which can be dangerous, because this can affect other reports which share these objects) this error can occur.
So, of course the fix is that in this case you have to redeploy datasource, dataset and Report to resolve the issue.
I was also facing the same issue - I checked below things to fix this issue,
If you have recently changed pointing database-name in data-source
then first check that all the store procedures for that report exist
on changed database.
If there are multiple sub reports on main report then make sure each
report individually running perfectly.
Also check security panel - user must have access to the databases/
tables/views/functions for that report.
Sometimes, we also need to check dataset1 - store procedure. As if you are trying to show the report with user1 and if this user doesn't have the access(rights) of provided (dataset1 database) database then it will throw the same error as above so must check the user have access of dbreader in SQL Server.
Also, if that store procedure contains some other database (Database2) like
Select * from XYZ inner join Database2..Table1 on ... where...
Then user must have the access of this database too.
Note: you can check log files on this path for more details,
C:\Program Files\Microsoft SQL Server\MSRS11.SQLEXPRESS\Reporting Services
I got same error but this worked and solved my problem
If report is connected to Analysis server then give required permission to the user (who is accessing reporting server to view the the reports) in your model of analysis server.
To do this add user in roles of model or cube and deploy the model to your analysis server.
Using SSRS, Report Builder 3.0, MSSQL 2008 and query to an Oracle 11G database,
I found that the oracle stored procedure ran well, produced consistent results with no errors. When I tried bringing the data into SSRS, I got the error as listed in OP's query. I found that the data loaded and displayed only if I removed the parameters (not a good idea).
On Further examination, I found that under dataset properties>parameters I had set the start date to parameterName P_Start and parameter Value to #P_Start.
Adding the Parameter value as [#P_Start] cleared the problem, and the data loads well, with parameters in place.
This problem was caused by an orphaned SQL Login. I ran my favorite sp_fixusers script and the error was resolved. The suggestion above to look at the logs was a good one...and it led me to my answer.
This might be the permission issue for your view or store procedure
In addition to the above answers, it could be due to a missing SQL stored-procedure or SQL function. For example, this could be due to the function not migrating from a non-prod region to the production (prod) region.
Removing all comments from the Select Query fixed this for me. My dataset was working in the Preview but when I went to Design/Query Designer and and tried the query there I was getting ORA-01006;bind variable does not exist. After removing all comments from the select it worked.

Why can I not register System.Web in SQL Server 2008?

Running this command:
CREATE ASSEMBLY
[System.Web] from
'C:\Windows\Microsoft.NET\Framework\v2.0.50727\system.web.dll'
with permission_set = UNSAFE
Gives me this error:
Msg 10300, Level 16, State 2, Line 1
Assembly 'System.Web' references assembly 'system.web, version=2.0.0.0, culture=neutral, publickeytoken=b03f5f7f11d50a3a.', which is not present in the current database. SQL Server attempted to locate and automatically load the referenced assembly from the same location where referring assembly came from, but that operation has failed (reason: version, culture or public key mismatch). Please load the referenced assembly into the current database and retry your request.
... this sounds a little silly. It seems like SQL Server thinks that the System.Web assembly is referencing it's self. How can I fix this?
Try with Framework64 assemblies (64 bit sql server 2008)
CREATE ASSEMBLY
[System.Web] from
'C:\Windows\Microsoft.NET\Framework64\v2.0.50727\System.Web.dll'
with permission_set = UNSAFE
GO
It sounds like you need to install the .Net 2.0 framework on your database server.
Also, I wouldn't directly add a reference to System.Web.dll. Your other custom CLR code should reference that. (Or, if you don't have custom .Net code, you should create a custom .Net project to interface into the System.Web assembly.)
Turns out System.web.dll isn't supported for this. In fact, it turned out that loading DLLs into SQL Server like this (for CLR) was a bad idea on many levels (one of which was 64/32-bit support between deployments).

Resources