Bonjour, j'ai un programme qui tourne sur plusieurs PC, chaque pc à ses ip à lui et son connection string pour la bdd
Exemple

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
 
#if WFA1
            WFA = 1;
 
            string[] WagoipAddress = new string[]
            {
                "194.176."+WFPP+".14",
                "194.176."+WFPP+".10",
                "194.176."+WFPP+".15",
                "194.176."+WFPP+".19",
                "194.176."+WFPP+".20",
                "194.176."+WFPP+".24"
            };
 
TheConnectionString = @"Data Source=DESKTOP-HT7\D1_SQL;Initial Catalog=WFPP" + WFA + ";User ID=25;Password=25"; 
#endif
#if WFA2
            WFPP= 2;
 
            string[] WagoipAddress = new string[]
            {
                "194.176."+WFPP+".14",
                "194.176."+WFPP+".10",
                "194.176."+WFPP+".15",
                "194.176."+WFPP+".19",
                "194.176."+WFPP+".20",
                "194.176."+WFPP+".24"
            };
TheConnectionString = @"Data Source=DESKTOP-HT7\D2_SQL;Initial Catalog=WFPP" + WFA + ";User ID=25;Password=25"; 
#endif
#if WFA3
            WFPP= 3;
 
            string[] WagoipAddress = new string[]
            {
                "194.176."+WFPP+".14",
                "194.176."+WFPP+".10",
                "194.176."+WFPP+".15",
                "194.176."+WFPP+".19",
                "194.176."+WFPP+".20",
                "194.176."+WFPP+".24"
            };
TheConnectionString = @"Data Source=DESKTOP-HT7\D3_SQL;Initial Catalog=WFPP" + WFA + ";User ID=25;Password=25"; 
#endif
Pour le moment j'utilise le #define pour pouvoir choisir la bonne configuration, mais cela me force de modifier à chaque fois sur le code source
je vous lais savoir si y'a moeyn de le faire les configurations via un fichier externe
si quelqu'un peut me donner un coup de main
merci