Goran Bibic

Goran Bibic

  • 482
  • 2.9k
  • 197.9k

Connection string in class C#

Jul 14 2019 2:25 AM
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
 
  1. string BSS_2018 = Properties.Settings.Default.BSS_2018CS;  
  2. string BSS_2019 = Properties.Settings.Default.BSS_2019CS;  
  3. string con;  
  4.   
  5.   
  6. InitializeComponent();  
  7. yearlabel.Text = getYear();  
  8.   
  9. public void PullData()  
  10.        {  
  11.            if (yearlabel.Text == "BSS_2018")  
  12.            {  
  13.                con = BSS_2018;  
  14.            }  
  15.            else if (yearlabel.Text == "BSS_2019")  
  16.            {  
  17.                con = BSS_2019;  
  18.            }  
  19.   
  20.   
  21.   
  22.        } 
 
 
 

Answers (1)