I'm using a resource file to store the database connection string. This was successfully deployed in {SharePointRoot}\Resources\. I tried editing the file and change some of the values just to test it but it's not getting the current value on the XML file instead it's still using the old value. I searched for any resource file in case it was saved somewhere else but I found none. Why is my web part still using the old connection string? I refreshed the page several times.

Old value:

 <data name="HBConnectionString" xml:space="preserve">
        <value>Data Source=DevServer;Initial Catalog=db;user=user;password=pwd;Pooling=false;</value>
        <comment>HelpBox connection string</comment>

new value:

 <data name="HBConnectionString" xml:space="preserve">
            <value>Data Source=TestServer;Initial Catalog=db;user=user;password=pwd;Pooling=false;</value>
            <comment>HelpBox connection string</comment>
  • Do you use SP2010 or SP2007? Are you deploying from Visual Studio? Commented May 26, 2011 at 7:57
  • you really shouldnt use resource files for this. Check my answer below... Commented May 26, 2011 at 9:10
  • I am using SP2010 and deploying on VS2010. Commented May 29, 2011 at 18:30

3 Answers 3


You should not store database connection strings in Resource files.

SharePoint 2010 has a new feature that can be used for this. It is called Secure Store Service.

Read this guide MSDN to get it working

  • How do you use Secure Store Service if you are you are passing the connection string to connect to a datacontext? This is basically the reason why I'm using the resource file for this because I don't know how to access the credentials I saved on the Secure Store Service. I only know how to use it when creating external content types but not with datacontext. I am creating a web part that accesses an external database, what will be the best approach for this without hard coding the connection string? thanks! Commented May 29, 2011 at 18:13

Depending on where you store your resources you need a different approach:

  • {SharePointRoot}\config\resources - These are copied to the wwwroot by issuing the following command: stsadm -o copyappbincontent
  • {SharePointRoot}\resources (your situation) - Requires an iisreset as these files are cached.

You might need to do an IISReset between making changes to SharePointRoot

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.