Sorry for the many asked question again, but i have not found a answer for solving my problem. First of all: I have a Web (customer-intranet, internal use only) where the user should decide, witch project should be shown. Every project has a connection to a database on different servers. So I have to change the connectionstring to the right database or I have to install the same web twice or more. I cannot use different connectstring-names, because the the dataset-designer stores the connectionname hardcoded in the c#-designer-code.
Is there really now way, to set the project-connectionstring maybe in the global.asax.cs? Or another way to handle this?
Perhaps you could change the designer code to not hard code the connection name?
Why not add a method somewhere called GetConnectionStringName()
which is called by the designer and will dynamically pick the correct connection string?
I just edit the C#-designer-code and replace it with a reference to the configuration manager connection string reference (or whatever floats your boat). It's generated automatically, that doesn't mean you can't edit it.
@Hunter Not shure, what you mean. we create a Dataset-class in the App_Data-Folder with contextmenu 'Add->Class'
@drachenstern I know, I could edit the designed code. That's not only me, who create webpages. And everytime something changed in the dataset-layout the code has to edit again. That's no option
@Nathan Taylor That's all in the designer-created code. I don't know, when the code is accessed and the connection will opened.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.