dc

dc

  • NA
  • 663
  • 0

2010 web.config file

Jul 10 2012 11:43 PM
I have the following questions about a linq to sql connection in a C# 2010 web
form application when comparing the *.dbml file to the web.config file:
The questions refer to the code listed below:

1. The top of the *.dbml file and the web.config file, there are refernces to
"TST_DEV" and "TST_DEV2". Can this discrepancy cause problems in the web form
application? If so, can you tell me how? I am asking this question since most
references in the production application refer to "TST_DEV" or "TST_DEV2" in the
same .dbml file and do not mix the references.

2. I do not understand what the
'name="Dmport.Properties.Settings.DBConnectionString" can be referring to. Can
you tell me what it is referring to?

3. Are the refernces to "DBConnectionString" in the .dbml file and web.config
file all related to each other? If so, would you tell me how all these items are
related to each other? If not, can you tell me what each "DBConnectionString" is
referring to?

top of .dbml file
<?xml version="1.0" encoding="utf-8"?><Database Name="TST_DEV"
Class="HisDataContext" xmlns="http://schemas.microsoft.com/linqtosql/dbml/2007">
  <Connection Mode="WebSettings" ConnectionString="Data
Source=SP9\MSSQL2008;Initial Catalog=TST_DEV2;Persist Security Info=True;User
ID=xx" SettingsObjectName="System.Configuration.ConfigurationManager.ConnectionS
trings"
SettingsPropertyName="DBConnectionString" Provider="System.Data.SqlClient" />

applicable web.config file

  <add name="DBConnectionString" connectionString="Data Source=sqldev;Initial
Catalog=Tst_DV;Persist Security Info=True;User ID=R2;Password=A"
providerName="System.Data.SqlClient" />
  <add name="Dmport.Properties.Settings.DBConnectionString"
connectionString="Data Source=sqldev;Initial Catalog=Tst_DV;Persist Security
Info=True;User ID=R2;Password=A" providerName="System.Data.SqlClient" />
  <add name="TST_DEVConnectionString" connectionString="Data
Source=sqldev;Initial Catalog=Tst_DV;Persist Security Info=True;User
ID=R2;Password=A" providerName="System.Data.SqlClient" />
  <add name="TST_DEV2ConnectionString" connectionString="Data
Source=sqldev;Initial Catalog=Tst_DV;Persist Security Info=True;User
ID=R2;Password=A" providerName="System.Data.SqlClient" />