locked
Rdlc Report in MVC Project being able to Switch databases. RRS feed

  • Question

  • User-544325736 posted

    Hello everyone,

    I currently have an MVC project that im going to be able to be switching 3 databases depending on the group of people using it. The databases all have the same tables. 1 is for the global engineers, 1 is for local production and 1 is for local testing.

    How should I have my rdlc reports so I can switch to a different database easily? I have my project so I just have to change a connectionstring in web.config and then the context in each controller. Then the database is changed. For a Rdlc report it will be a little harder than that, do I need to add another dataset and just have to change that? On my reports it only allows me to add 1 data source at a time but in the datasets I can have multiple and each 1 can point to its own connectionstring.

    Tuesday, August 6, 2019 3:42 PM

All replies

  • User-1174608757 posted

    Hi ExceedingLife,

    According to your description,  do you have three connection strings for three databases in  web.config file?

    Since reportviewer control uses rdlc as the datasource ,I think you should create multiply rdlc file as different datasource you want to replace. For example, if you want to replace the datasource of reportviewer ,you could firstly create a new rdlc file and set dataset on it.Then you could create datasource for report view and replace the original one by writing code in some trigger.

    Best Regards

    Wei

    Wednesday, August 7, 2019 2:23 AM