Can we declare variables in the 'app.config' file?

后端 未结 4 1002
甜味超标
甜味超标 2020-12-16 01:26

I have a form which needs to get connected to SQL Server, and I have a drop down for selecting the list of databases and perform operations like primary key checking, etc.

4条回答
  •  一生所求
    2020-12-16 02:07

    I think he wants a "semi constant":

    Web.Config

    
    
        
            
        
    
    

    CS file

    String Servername = "Test";
    String ConnectionString = String.Format(ConfigurationManager.ConnectionStrings["YourName"].ConnectionString, ServerName);
    

提交回复
热议问题