0

I am trying to learn mvc3/4 by trying to build my current project. How do you set the connection string for enterprise library? I have downloaded the libraries and added as reference. But I dont know how to set the connection string.

this is what I have now...

<connectionStrings>
<add name="DefaultConnection" providerName="System.Data.SqlClient" connectionString="Data Source=(LocalDb)\v11.0;Initial Catalog=UpdatedProducts;User ID=myUsername;Password=myPassword;AttachDBFilename=|DataDirectory|\aspnet-GuncelMalzemeler-20130430221215.mdf" />

do you guys have any idea how to set this connection?

1

1 Answer 1

1

It's like this:

<configuration>
  <configSections>
    <section name="dataConfiguration" 
       type="Microsoft.Practices.EnterpriseLibrary.Data.Configuration.DatabaseSettings,
            Microsoft.Practices.EnterpriseLibrary.Data, Version=5.0.414.0, 
            Culture=neutral, PublicKeyToken=null" 
        requirePermission="false"/>
  </configSections>

  <dataConfiguration defaultDatabase="DefaultConnection" />

  <connectionStrings>
        <add name="DefaultConnection" providerName="System.Data.SqlClient" connectionString="Data Source=(LocalDb)\v11.0;Initial Catalog=UpdatedProducts;User ID=myUsername;Password=myPassword;AttachDBFilename=|DataDirectory|\aspnet-GuncelMalzemeler-20130430221215.mdf" />
  </connectionStrings>
</configuration>

You may need to change the section type attribute based on the version of the enterprise library you are using.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.