Solved

Shared data source details within a reporting services custom code function

Posted on 2007-03-22
7
928 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
[Webinar] Disaster Recovery and Cloud Management

Learn from Unigma and CloudBerry industry veterans which providers are best for certain use cases and how to lower cloud costs, how to grow your Managed Services practice in IaaS clouds, and how to utilize public cloud for Disaster Recovery

 
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

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.

Question has a verified solution.

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

Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.

920 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now