This is a migrated thread and some comments may be shown as answers.

Set connectionstring from outside code

0 Answers 93 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
AnneArents
Top achievements
Rank 1
AnneArents asked on 22 Mar 2011, 11:19 AM
Hi,

I have a report in an ASP.NET website that uses an SqlDatasource with stored procedure to get the data I require.
I create a pdf from the report on runtime, and what I'm trying to do is change the connectionstring on runtime.
I know I can add code to the constructor to get the connectionstring from the web.config, but this requires a fixed connectionstring name, and I don't want this.
I also know the Datasource is accessible, but I don't want to set the datasource, just the connectionstring
So what I'm looking for is a way to pass the connectionstring to the report somehow.
As a parameter won't work, however, since the parameters aren't set yet when the constructor is called.

Any ideas?

CJ

No answers yet. Maybe you can help?

Tags
General Discussions
Asked by
AnneArents
Top achievements
Rank 1
Share this question
or