How to get Connection String ?

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
5 years ago
This code is not working anymore.

https://www.nopcommerce.com/boards/t/18539/how-to-get-connection-string-from-_context-in-my-code.aspx

var connectionString = new DataSettingsManager().LoadSettings().DataConnectionString;
5 years ago
Hi,

I can help.

You can reach me on Skype: cisin.justin or Email: [email protected] so that we can discuss this further.



Justin
+14074139057
5 years ago
ritwickdey wrote:
This code is not working anymore.

https://www.nopcommerce.com/boards/t/18539/how-to-get-connection-string-from-_context-in-my-code.aspx

var connectionString = new DataSettingsManager().LoadSettings().DataConnectionString;
.


May I know which version of Nopcommerce are you using??
5 years ago
latest one.. I think 4.1... (asp
net core 2.1)
5 years ago
Hello,

You can use below code to get connection string in 4.10.




using Nop.Core.Data;

var dataSettings = DataSettingsManager.LoadSettings();




2 years ago
Hi guys,
for the junior developers like myself who are using nopCommerce version 4.3 to find out what ConnectionSring you're using, if you'are using Visual Studio 2019, simply find the DataSettings class by searching for DataSettings.cs inside the search box.
Within this class try to find the ConnectionString property(which is named ConnectionString) and make a breakpoint on this property. once you run the project with the debugger if you move the cursor on the property the ConnectionString will be shown.
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.