Connection string in class C#

  • 260 Views
  • Last Post 22 July 2019
Stylus STYLUS posted this 14 July 2019

I make accounting app

Need to add class with multiple Connection string

Type

Public class

database
Database name BSS_2018, BSS_2019...etc
Database username a
Database password a

Database2017
Database2018
Database2019
etc..


This is good way, but have new year must add string in ALL FORMS in APP.
Need to create class with this data
Some help?

What I have tried:

Using before this way with label  

string BSS_2018 = Properties.Settings.Default.BSS_2018CS;  
string BSS_2019 = Properties.Settings.Default.BSS_2019CS;  
string con;  


InitializeComponent();  
yearlabel.Text = getYear();  

public void PullData()  
       {  
           if (yearlabel.Text == "BSS_2018")  
           {  
               con = BSS_2018;  
           }  
           else if (yearlabel.Text == "BSS_2019")  
           {  
               con = BSS_2019;  
           }  



       }  
Stylus STYLUS posted this 22 July 2019

No help?

Close