Tangara G

Tangara G

  • NA
  • 298
  • 94k

how do i test if my connection in my web config is correct ?

Jan 29 2017 10:13 PM
Hi expert,
 
I am now doing a test using my home PC cos I am so used to doing things via entity framework I really forgot how to write the connection string inside my web.config.
 
My database name is test.
 
And here's how I do it inside my web.config:
 
  1. <connectionStrings>  
  2.    <add name="DefaultConnection" connectionString="Data Source=(LocalDb)\v11.0;AttachDbFilename=|DataDirectory|\aspnet-WebApplication9-20170128051949.mdf;Initial Catalog=aspnet-WebApplication9-20170128051949;Integrated Security=True"  
  3.      providerName="System.Data.SqlClient" />  
  4.    <add name="ConnTest" connectionString="Data Source=localhost;Initial Catalog=test;Integrated Security=True;" providerName="System.Data.SqlClient" />  
  5.  </connectionStrings> 
 Hope someone can tell me if it is correct or how can I ascertain that it is connected ?
Tks.
 

Answers (2)