Q ) Web Configuration
* Web Configuration *
- Web.Confige connection string is use to set database path in configuration file.
Step :- 1) solution explorer -- web.config --right click open.
2) <configuration>
<appSettings>
< add key="db1" value="Data Source=.\SQLEXPRESS;Initial Catalog=vnit;Integrated Security=True" />
</appSettings>
</configuration>
Q ) How to access connection with configuration.
Step :- Add library :- Using System.Configuration ;
Cn code :- string path =ConfigurationManager.AppSettings["db1"];
cn = new SqlConnection(path);
cn.Open();
Comments
Post a Comment