DataGridView1.DataSource = ObjetDataTable2
ObjetCB2 = New OleDbCommandBuilder(ObjetDataAdapter2)
' ObjetDataAdapter2.Update(ObjetDataSet2, "Offres")
' ObjetDataSet2.Clear()
' ObjetDataAdapter2.Fill(ObjetDataSet2, "Offres")
' ObjetDataTable2 = ObjetDataSet2.Tables("Offres")
' ObjetConnection.Close()
Try
ObjetConnection.Open()
Dim requete As String = "UPDATE Offres SET MONTANT = Montant where ID_OFFRE= ID_Odp"
MsgBox(requete)
Dim commande As New OleDbCommand(requete, ObjetConnection)
commande.ExecuteNonQuery()
commande.Dispose()
ObjetConnection.Close()
Catch ex As Exception
MsgBox(ex.ToString)
ObjetConnection.Close()
End Try
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre questionClass Client//pas utile dans l'option 2 Public Property ID_Client() As Integer Public Property Nom() As String End Class Class Offre//pas utile dans l'option 2 Public Property ID() As Integer Public Property ID_Offre() As Integer Public Property ID_Client() As Integer Public Property Montant() As Double End Class Class Jointure Public Property ID() As Integer Public Property ID_Client() As Integer Public Property Montant() As Double Public Property Nom() As String End Class
'pour que je puisse tester chez moi Dim clients As New List(Of Client)() From { New Client With {.ID_Client = 1, .Nom = "NOM1"}, New Client With {.ID_Client = 2, .Nom = "NOM2"}, New Client With {.ID_Client = 3, .Nom = "NOM3"}} Dim offres As New List(Of Offre)() From { New Offre With {.ID = 1, .ID_Offre = 1, .ID_Client = 1, .Montant = 1000}, New Offre With {.ID = 2, .ID_Offre = 1, .ID_Client = 3, .Montant = 2000}, New Offre With {.ID = 3, .ID_Offre = 3, .ID_Client = 3, .Montant = 3000}} 'fin d'init chez moi 'Option1 ici faire en sorte que clients et offres soient remplies avec les 2 tables Dim jointures As List(Of Jointure) = ( From c In clients Join o In offres On c.ID_Client Equals o.ID_Client Where o.ID_Offre = 1 Select New Jointure With {.ID = o.ID_Offre, .ID_Client = o.ID_Client, .Nom = c.Nom, .Montant = o.Montant}).ToList() 'Option2 remplir jointures avec le résultat de ta requête. DU coup les classes Client et Offre ne te servent pas dataGridView1.DataSource = jointures 'Modification des données pour le test jointures(0).Nom = "Nouveau nom" jointures(1).Montant = 9999 'création des 2 listes de mise à jour Dim clientsMAJ As List(Of Client) = ( From j In jointures Select New Client With {.ID_Client = j.ID_Client, .Nom = j.Nom}).ToList() Dim offresMAJ As List(Of Offre) = ( From j In jointures Select New Offre With {.ID_Offre = j.ID, .Montant = j.Montant}).ToList() 'TODO faire les 2 requettes Upadte