bonjour j'ai une datagridview et je veux la transférer a ma base voila le code que j'ai fais mais ça marche pas :
merci de m'aider
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 Ligne li = new Ligne(); for (int i = 0; i <= dataGridView1.Rows.Count-2 ; i++) { for (int j = 0; j <= 4; j++) { li.NC = int.Parse(dataGridView1.Rows[i].Cells[j].Value.ToString()); li.codeP = int.Parse(dataGridView1.Rows[i].Cells[j].Value.ToString()); li.Qte = int.Parse(dataGridView1.Rows[i].Cells[j].Value.ToString()); li.Prix = float.Parse(dataGridView1.Rows[i].Cells[j].Value.ToString()); li.Montant = float.Parse(dataGridView1.Rows[i].Cells[j].Value.ToString()); } } l.dc.Ligne.InsertOnSubmit(li); l.dc.SubmitChanges();
Partager