0

we enabled our clients to change databases, in the back-end the code obviously changes the connection string in the app.config but somehow, somewhere the app loaded one specific connection string into memory and only when we restart the app the new connection string is applied.

<add name="DMRQueries" connectionString="metadata=res://*/Model.csdl|res://*/Model.ssdl|res://*/Model.msl;provider=System.Data.SqlClient;provider connection string=&quot;data source=xxx.xxx.xxx.xxx,xxxx;initial catalog=OHS-DemoDataset;persist security info=True;user id=sa;password=xxxxxxxx;MultipleActiveResultSets=True;App=EntityFramework&quot;"
  providerName="System.Data.EntityClient" />

I know it is this auto-generated connection string. (this connection string was generated by RDLC dataset if I'm not mistaken)

I don't know how to refresh it in memory without restarting the app.

Even though we change the connection string while the app is running it still pulls data from the old source

Please help I'm pulling my hair out

Thank you.

Hancs
  • 303
  • 1
  • 5
  • 19
  • This is a Entity Framework Connection String.. it's been already [answered](https://stackoverflow.com/questions/20216147/entity-framework-change-connection-at-runtime) how to change it dynamically. – Peter Schneider Dec 07 '19 at 09:38
  • I already have to code working to change it but my issue is the change is only applied when the app is restarted. Edit: the actual text in app.config changes but in the app it's still pulling data from the old database before it was changed – Hancs Dec 07 '19 at 09:39
  • IT looks currect .But check the name value – LDS Dec 07 '19 at 11:45

0 Answers0