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

Popular posts from this blog

DATA CONTROL ( Gridview , Repeater , Formview , DataList , Detailsview , Listview )

Z 5 ) MVC (Model view Controller)

Z 8 ) MVC HTMLHELPER METHOD AND ACTIONLINK (how to use css ,atrributes,style in css)