Solved

Shared data source details within a reporting services custom code function

Posted on 2007-03-22
7
933 Views
Last Modified: 2008-01-09
I'm successfully querying my database from within a custom code function within an SSRS 2005 report.

My problem is that I'm hard coding the connection string within the function (System.Data.SqlClient.SqlConnection) - I need to be able to use the same connection as the shared data source that the report uses. I could grab the details from a registry setting or some other work around, but for tidyness and simplicity I really want to get the code to seemlessly talk to the same database.

I either need to pass in the connection details as a parameter to the function, or get the details from within the function - either would be fine.

Anyone got any ideas?...
0
Comment
Question by:PFrog
  • 3
  • 2
7 Comments
 
LVL 11

Expert Comment

by:Ved Prakash Agrawal
ID: 18770074
http://www.code-magazine.com/article.aspx?quickid=0701061&page=2

please just check it out this site may be help full for you.
0
 
LVL 18

Author Comment

by:PFrog
ID: 18770103
Thanks ved17nov, but that shows how to get what I already have - a static, hard coded connection string.

I'm trying to make the code dynamically set its own connection string to be the same as the shared data source.
0
 
LVL 18

Author Comment

by:PFrog
ID: 18770104
I have to say, I don't think it is possible - however with the combined genius of all our experts I'm hoping someone will come up with something!
0
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
LVL 18

Expert Comment

by:chrismc
ID: 18770195
I can't help you outright. But if there is a way to hook into the reports security/connection try trawling through the Microsoft.ReportingServices namespace, I would expect an object or method in there to allow you to do it - after all it's what Reporting Services itself is going to be using.

Cheers
Chris
0
 
LVL 18

Accepted Solution

by:
PFrog earned 0 total points
ID: 18791515
Thanks chrismc - I've had a long play with this and can't get the details out - although I certainly don't claim to be a .Net expert! A microsoft guy on their forums has also said it isn't possible - oh well, maybe it will be available in future releases.

I've resorted to storing a connection string in the database (pointing to itself!), querying it as a parameter of the report, then passing it in as a parameter to the custom code function.

Not that pretty, but at least it saves having to add a registry entry to each client machine.

Thanks anyway

Mods - can you please close the question?
0
 
LVL 18

Expert Comment

by:chrismc
ID: 18791524
No probs.

Cheers
Chris
0

Featured Post

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

In this article we will get to know that how can we recover deleted data if it happens accidently. We really can recover deleted rows if we know the time when data is deleted by using the transaction log.
This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question