I'm new to ASP.NET-ville, be gentle.
I have been troubleshooting a ASP.NET setup, where the server/database values are changing, therefore web.config needs to be updated.
There are multiple <add name="NameXYZ" connectionString="blah" />
instances (multiple ASP.NET components), but some of these are marked up differently to others.
I've got the following provided:
<add name="CONNECTION-B" connectionString="metadata=res://*/ZZZZ.ssdl;provider=System.Data.SqlClient;provider connection string="Data Source=XXX;Initial Catalog=YYY;Persist Security Info=True;User ID=AAA;Password=BBBB;MultipleActiveResultSets=True"" providerName="System.Data.EntityClient" />
<add name="CONNECTION-A" connectionString="server=XXX;database=YYY;user id=XXX;password=BBB" />
I've used substituted values in the above, making the assumption that for both format types:
(ZZZZ is a pipe-delimited list of something)
Questions are as follows:
A) Is my assumption of synonymous connection string terms accurate? (Data Source <=> server, database <=> initial catalog)
B) Are there any syntax errors in the markup? Some MSDN documents I've looked up use double, single, and "
marks interchangeably.
The Metadata parameter contains a list of locations for the EntityClient provider to search for model and mapping files. Model and mapping files are often deployed in the same directory as the application executable file.
The providerName attribute is used to set the name of the .NET Framework data provider that the DataSource control uses to connect to an underlying data source. If no provider is set, the default is the ADO.NET provider for Microsoft SQL Server.
Connection string holds information that is required to communicate with the database. You can use connection string with any database like MSSQL, MySQL, MS Access etc. Some of the main parameters present in Asp . Net connection string are: 1) “name”: Name of the connection stirng.
Start LocalDB and connect to LocalDB To connect to a specific database by using the file name, connect using a connection string similar to Server=(LocalDB)\MSSQLLocalDB;Integrated Security=true;AttachDbFileName=D:\Data\MyDB1. mdf .
There are two different types of connection strings here. The best bet (IMO) is to have a read up in the docs -
The first is an ADO.Net connection string: http://msdn.microsoft.com/en-us/library/ms254500.aspx
The second is an Entity Framework connection string: http://msdn.microsoft.com/en-us/library/cc716756.aspx
It's all explained in those two links, certainly clearer than I can explain it!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With