Несколько строк подключения mssql в классе C#
Need for my app Have database 2017,2018,2019...I add IN every form connection string
string BSS_2017 = Properties.Settings.Default.MG_SISTEM_2017CS; string BSS_2018 = Properties.Settings.Default.MG_SISTEM_2018CS; string BSS_2019 = Properties.Settings.Default.MG_SISTEM_2019CS; string con;
Then in label chek value (2017,2018 or2019)
public popis() { InitializeComponent(); yearlabel.Text = getYear(); }
And connect
private String getGodina() { string value = login.godina.ToString(); return value; } public void PullData() { if (yearlabel.Text == "2017") { con = BSS_2019; } else if (yearlabel.Text == "2018") { con = BSS_2018; } else if (yearlabel.Text == "2019") { con = BSS_2019; } }
Что я уже пробовал:
That work fine...but...I must put this in every form in my app....need help To create some class with this value. Help?