Bonjour à tous,

je suis en train de migrer mon code VB en C# ( Super outil https://github.com/icsharpcode/CodeC...ster/README.md)
je coïnce sur l'exécution d'une requête SQL avec ADODB : Comment dois-je faire s.v.p. ?
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
        public static void Insertions(string MyFile)
        {
            string MyString;

            // demande de connexion accessmatic
            Gestion.Cn=new ADODB.Connection();
            Gestion.Cn.Open("Provider=Microsoft.ACE.OLEDB.16.0;Data Source=ACCESSMATIC.ACCDB;Persist Security Info=True", "", "", -1);
            Gestion.Cns=new ADODB.Connection();
            Gestion.Cns.Open("Provider=Microsoft.ACE.OLEDB.16.0;Data Source=STATSHIPPODROMES.ACCDB;Persist Security Info=True", "", "", -1);
            var monStreamReader = new StreamReader(MyFile, Encoding.Latin1);
            MyString=monStreamReader.ReadLine();
            do
            {
                if (Conversions.ToBoolean(Strings.InStr(MyString, "DatesHippodromes")|Strings.InStr(MyString, "DatesChevaux")))
                {
                    Gestion.Cns.Execute(MyString);
                }
                else
                {
                    Gestion.Cn.Execute(MyString);
                }

                MyString=monStreamReader.ReadLine();
            }
            while (MyString is not null);
            monStreamReader.Close();
            Gestion.Cns.Close();
            Gestion.Cns=null;
            Gestion.Cn.Close();
            Gestion.Cn=null;
        }