cs_mohellebi
Messages postés98Date d'inscriptionmercredi 31 octobre 2007StatutMembreDernière intervention 1 août 2019
-
31 janv. 2014 à 14:00
Whismeril
Messages postés18991Date d'inscriptionmardi 11 mars 2003StatutContributeurDernière intervention27 mars 2024
-
2 févr. 2014 à 10:36
Bonjour, tout le monde
j'utilise un datagridviewer sous vb 2010\SQL server 2008, maintenant je voudrais balayer toute ma table et la mettre à jour
je m'explique ,j 'ai une colonne status dans ma table avec une valeur 0 ensuite d'afficher dans mon datagrid juste les enregistrements dont j'ai besoin de changer le statue à 1.
pour info j'utilise ce code pour modifier mes enregistrements un par un, chose pas évidente
Dim Cn As New SqlConnection
Cn = New SqlConnection("Data Source=.\sqlexpress;Initial Catalog=vente;Integrated Security=True")
Cn.Open()
Dim UpdateCommande As String = "Update article set nomarticle=@N,prix=@P,prixvente=@V,status=@S where Code=@C"
Dim UpDateCom As New SqlCommand(UpdateCommande, Cn)
UpDateCom.Parameters.Clear()
UpDateCom.Parameters.AddWithValue("@N", NomTextbox.Text)
UpDateCom.Parameters.AddWithValue("@P", prixTextBox.Text)
UpDateCom.Parameters.AddWithValue("@V", venteTextBox.Text)
UpDateCom.Parameters.AddWithValue("@C", CodeTextBox.Text)
UpDateCom.Parameters.AddWithValue("@S", statusTextBox.Text)
UpDateCom.ExecuteNonQuery()
MsgBox("L'élément est modifié", MsgBoxStyle.Information, "Modifier")
Merci d'avance pour vos solutions qui me permettrons d'avancer dans mon projet