Solved

Shared data source details within a reporting services custom code function

Posted on 2007-03-22
7
935 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

 
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

Free Webinar: AWS Backup & DR

Join our upcoming webinar with experts from AWS, CloudBerry Lab, and the Town of Edgartown IT to discuss best practices for simplifying online backup management and cutting costs.

Question has a verified solution.

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

In this article I will describe the Backup & Restore method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
The Delta outage: 650 cancelled flights, more than 1200 delayed flights, thousands of frustrated customers, tens of millions of dollars in damages – plus untold reputational damage to one of the world’s most trusted airlines. All due to a catastroph…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Via a live example, show how to shrink a transaction log file down to a reasonable size.

696 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