bonjour

j'ai crée une méthode qui fait insérer des profiles des user dans la table "C2RP.dbo.profile" mais j'ai rien trouvé dans la base de donnée je vou montre le code et svp aidez moi à la rectifier :

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
45
46
47
48
49
50
51
52
53
54
 
 
private void inserer(object sender,routedEventArgs e)
{
   string chemin="textBox2";
   string nom;
   string prenom;
   string actif;
 
DataTable m_Datatable=new DataTable();
sqlConnection pConnection  = new sqlConnection();
sqlDataAdapter adapter = new sqlDataAdapter();
pConnection.open();
 
 
  using (FileStream fs = File.OpenRead("c:\\chemin.csv"))
 
{
 
  using (StreamReader sr = new StreamReader(fs))
 
  {
 
    while (!sr.EndOfStream)
 
    {
 
      string[] values = sr.ReadLine().Split(';');
 
            nom = values[2];
 
            prenom = values[7];
 
            actif= values[11];
 
     // construction de la requête 
 
    string QueryString = "Insert into C2RP.dbo.profile (pr_actif,pr_nom,pr_prenom) VALUES (actif,nom,prenom)";
 
   //Exécution de la requête 
 
                SqlCommand command = new SqlCommand(QueryString, pConnection);
                command.CommandTimeout = 0;
                adapter.SelectCommand = command;
                adapter.Fill(m_DataTable);
 
                //Fermeture de la connection
 
                pConnection.Close();
 
        }
     }
   }
}