ConnectionString="<%$ ConnectionStrings:ConnectionString %>" (from
web.config file)
Connection String in
aspx.cs_page
SqlConnection cnn = new SqlConnection();
cnn.ConnectionString = System.Configuration.ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
Connection String in
Web.config_page
<configuration>
<appSettings/>
<connectionStrings>
<add
name="ConnectionString" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\Database.mdf;Integrated
Security=True;User Instance=True"
providerName="System.Data.SqlClient"
/>
</connectionStrings>
Or
<connectionStrings>
<add
name="ConnectionString" connectionString="Server=omgoelmdfromusa.db.2263994.hostedresource.com;
Database=omgoelmdfromusa;User ID=omgoelmdfromusa;Password=Bondo@321;
Trusted_Connection=False"
providerName="System.Data.SqlClient" />
</connectionStrings>
No comments:
Post a Comment