Je suis débutant en c#, j'ai un data table qui contient deux colonne timemodif et filename
Comment je récupères les lignes dans un fichier texte
voici mon code que j'ai utilisé
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
 
StreamWriter sw = new StreamWriter("C:\\Documents and Settings\\Jihed\\Desktop\\code.txt", false);
foreach (DataRow row in table.Rows)
 
            {
 
                object[] array = row.ItemArray;
 
                for (int i = 0; i < array.Length - 1; i++)
                {
                    sw.Write(array[i].ToString() + " ");
 
 
                }
 
                int j = 0;
                sw.Write(array[j].ToString());
                sw.WriteLine();
            }
voici le resultat ecrites sur mon fichier texte
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
C:\eula.1042.txt C:\eula.1042.txt
C:\eula.1041.txt C:\eula.1041.txt
C:\eula.3082.txt C:\eula.3082.txt
C:\eula.2052.txt C:\eula.2052.txt
C:\eula.1040.txt C:\eula.1040.txt
C:\eula.1031.txt C:\eula.1031.txt
C:\eula.1028.txt C:\eula.1028.txt
C:\eula.1036.txt C:\eula.1036.txt
C:\eula.1033.txt C:\eula.1033.txt
cependant en les affichant dans un datagridview je vois les deus colonne qui contienne les deux champs