How to write connection string in web.config file and read from it?

后端 未结 7 1315
日久生厌
日久生厌 2020-12-16 00:57

I\'m trying to write Connection string to Web.config like this:


  

        
7条回答
  •  悲&欢浪女
    2020-12-16 01:18

    Add reference to add System.Configuration:-

    System.Configuration.ConfigurationManager.
        ConnectionStrings["connectionStringName"].ConnectionString;
    

    Also you can change the WebConfig file to include the provider name:-

    
      
    
    

提交回复
热议问题