ASP.NET Connection String Metadata Syntax

I am new to ASP.NET-ville, be careful.

I was looking for an ASP.NET installation where server / database values ​​are changing, so web.config needs to be updated.

There are several instances of <add name="NameXYZ" connectionString="blah" /> (several ASP.NET components), but some of them differ from each other in a different way.

I have the following:

 <add name="CONNECTION-B" connectionString="metadata=res://*/ZZZZ.ssdl;provider=System.Data.SqlClient;provider connection string=&quot;Data Source=XXX;Initial Catalog=YYY;Persist Security Info=True;User ID=AAA;Password=BBBB;MultipleActiveResultSets=True&quot;" providerName="System.Data.EntityClient" /> <add name="CONNECTION-A" connectionString="server=XXX;database=YYY;user id=XXX;password=BBB" /> 

I used the replaced values ​​in the above example, making the assumption that for both types of formats:

  • XXX is a server (MSSQL host)
  • YYY is the name of the database
  • AAA is a database user and
  • BBB is the user password.

(ZZZZ is a list divided by pipeline)

The questions are as follows:

A) Is my assumption of string terms synonymous with joins accurate? (Data source <=> server, database <=> initial directory)

B) Are there any syntax errors in the markup? Some of the MSDN documents I've been looking at use interchangeably double, single, and &quot; tags.

+7
source share
3 answers

There are two different types of connections here. The best bet (IMO) should be read in the docs -

The first line of the ADO.Net connection: http://msdn.microsoft.com/en-us/library/ms254500.aspx

Second line of the Entity Framework connection: http://msdn.microsoft.com/en-us/library/cc716756.aspx

Everything is explained in these two links, of course, more clearly than I can explain it!

+7
source

Here you can find a great source of information about connection strings:

http://www.connectionstrings.com/

+3
source

I felt the need to publish this, as I also had some problems with this, and later it turned out that there was a difference in the connection string requirements for the codefirst / model / database approaches:

MS Blog post about configuration settings for entitiy interface connection strings

+1
source

All Articles