28-04-17, 05:24 AM
السلام عليكم
هذا كود يجفظ مباشرة من داتا جريد فيو الى قاعدة البيانات
For Each row As DataGridViewRow In DataGridView1.Rows
prix_vente = row.Cells(2).Value
qte_vendu1 = row.Cells(3).Value
htc = qte_vendu1 * prix_vente
ttc = htc + (htc * tva) / 100
Dim cmd As SqlCommand = connectt.CreateCommand
cmd.CommandText = "INSERT INTO vente(code_article,designation_article,prix_vente,qte_vendu,tva,code_facture,htc,ttc)" & _
"VALUES(@code_article,@designation_article,@prix_vente,@qte_vendu,@tva,@code_facture,@htc,@ttc)"
cmd.Parameters.AddWithValue("@code_article", row.Cells(0).Value)
cmd.Parameters.AddWithValue("@designation_article", row.Cells(1).Value)
cmd.Parameters.AddWithValue("@prix_vente", row.Cells(2).Value)
cmd.Parameters.AddWithValue("@qte_vendu", row.Cells(3).Value)
cmd.Parameters.AddWithValue("@tva", NumericUpDown1.Value)
cmd.Parameters.AddWithValue("@code_facture", code_facture11.ToString)
cmd.Parameters.AddWithValue("@htc", htc)
cmd.Parameters.AddWithValue("@ttc", ttc)
cmd.ExecuteNonQuery()
cmd.Dispose()
total_htc = total_htc + htc
total_ttc = total_ttc + ttc
Next
هذا كود يجفظ مباشرة من داتا جريد فيو الى قاعدة البيانات
For Each row As DataGridViewRow In DataGridView1.Rows
prix_vente = row.Cells(2).Value
qte_vendu1 = row.Cells(3).Value
htc = qte_vendu1 * prix_vente
ttc = htc + (htc * tva) / 100
Dim cmd As SqlCommand = connectt.CreateCommand
cmd.CommandText = "INSERT INTO vente(code_article,designation_article,prix_vente,qte_vendu,tva,code_facture,htc,ttc)" & _
"VALUES(@code_article,@designation_article,@prix_vente,@qte_vendu,@tva,@code_facture,@htc,@ttc)"
cmd.Parameters.AddWithValue("@code_article", row.Cells(0).Value)
cmd.Parameters.AddWithValue("@designation_article", row.Cells(1).Value)
cmd.Parameters.AddWithValue("@prix_vente", row.Cells(2).Value)
cmd.Parameters.AddWithValue("@qte_vendu", row.Cells(3).Value)
cmd.Parameters.AddWithValue("@tva", NumericUpDown1.Value)
cmd.Parameters.AddWithValue("@code_facture", code_facture11.ToString)
cmd.Parameters.AddWithValue("@htc", htc)
cmd.Parameters.AddWithValue("@ttc", ttc)
cmd.ExecuteNonQuery()
cmd.Dispose()
total_htc = total_htc + htc
total_ttc = total_ttc + ttc
Next
