0

I have issue with my connectionstring:

App.config

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <connectionStrings>
    <add name="prod" connectionString="YourConnectionString"/>
  </connectionStrings>
</configuration>

EventReceiverClass.cs

    public override void ItemAdding(SPItemEventProperties properties)
    {
        string conn = ConfigurationManager.ConnectionStrings["prod"].ConnectionString;
    }

and I got error: An exception of type 'System.NullReferenceException' on it. I tested it on a simple console app and it works as expected. Any suggestions?

0

You should save the connectionstring in web.config of your SharePoint web application.

enter image description here

enter image description here

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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