bonjour,
jai une table da base de données sql et je veux faire une modification dans l'un des ses paramétres le probléme est que quand je veux excécuter ça marche pas et je comprend pas pourquoi
merci de m'aoder voila mon code
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 'Chaîne de connexion Dim MyConnexion As SqlConnection = New SqlConnection("Data Source=BNR-LAP-547707;Initial Catalog=Mon1;User ID=sa ; password = *****") 'Objet connection Dim Mycommand1 As SqlCommand = MyConnexion.CreateCommand() 'Ouverture MyConnexion.Open() Dim p As Integer = DGV.DataGridView1.Rows.Count Dim i As Integer For i = 0 To (p - 1) Dim strRequete As String = "UPDATE composantes SET quantite = quantite - '" & DGV.DataGridView1.Rows(i).Cells(3).Value.ToString & " ' where ref_compo = '" & DGV.DataGridView1.Rows(i).Cells(0).Value.ToString & "' and Date_EM = '" & DateTimePicker2.Value.ToString("dd/MM/yyyy") & "')" Debug.WriteLine(strRequete) Dim Command1 As New SqlClient.SqlCommand(strRequete, MyConnexion) Command1.ExecuteNonQuery() Next
Partager