This article is a mirror article of machine translation, please click here to jump to the original article.

View: 15677|Reply: 0

[ASP.NET] asp.net modify the LINQ app.config configuration file to web.config

[Copy link]
Posted on 6/10/2015 9:32:45 PM | | |
First, add a .net reference to System.Configuration

Then add using System.Configuration on top of the ling's cs file

Modifications:

  1. public HpDBDataContext() :
  2.         base(ConfigurationManager.ConnectionStrings["SQLConn"].ConnectionString, mappingSource)
  3.                 {
  4.                         OnCreated();
  5.                 }
Copy code
This is what I have modified and then configured the connection string in the site's web.config

  1. <connectionStrings>
  2.     <add name="ApplicationServices"
  3.          connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\aspnetdb.mdf;User Instance=true"
  4.          providerName="System.Data.SqlClient" />
  5.     <add name="SQLConn" connectionString="Data Source=.;Initial Catalog=HouPu;Integrated Security=True" providerName="System.Data.SqlClient" />
  6.   </connectionStrings>
Copy code






Previous:ASP.NET uses MD5 encryption
Next:XML generated using the SQL statement for xml
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com