Solved

Shared data source details within a reporting services custom code function

Posted on 2007-03-22
7
925 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 
LVL 18

Expert Comment

by:chrismc
Comment Utility
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
Comment Utility
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
Comment Utility
No probs.

Cheers
Chris
0

Featured Post

Zoho SalesIQ

Hassle-free live chat software re-imagined for business growth. 2 users, always free.

Join & Write a Comment

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…
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.
Via a live example, show how to setup several different housekeeping processes for a SQL Server.

763 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

12 Experts available now in Live!

Get 1:1 Help Now