Bonjour
Lorsque je double-click sur mon datagrid les informations de chacunes ces cellules de la ligne choisi sont affichés, dans leur textbox respectif, dans une autre form.
Mon problème que lorsque j'enregistre mes modifications je ne réussi pas à mettre mon datagrid à jour automatiquement.
De ma form d'où j'enregistre mes modifs, j'appel la fonction qui rempli le datagrid dans l'autre form.
Mais rien ne se passe.
Voici mon code :
Dans ma form où je fais mes modifs
Dim frmSommaireParZone As New frmSommaireParZone
frmSommaireParZone.fillDataGrid(Me.txtBrand.Text, Me.txtStoreNumber.Text)
Dans ma form où se situe le datagrid
Public Sub fillDataGrid(ByVal strBrand As String, ByVal strStoreNumber As String)
Try
Dim strSql As String
Dim dsDescription As New DataSet
strSql = "SELECT SP.StoreName, " + _
" SP.CountryCode, " + _
" SP.CountryName, " + _
" SP.StoreGrade, " + _
" SP.Status, " + _
" SP.NbLignes, " + _
" ZD.Name, " + _
" ZD.Numero, " + _
" ZD.DescriptionZone, " + _
" ZD.FixOrMovable, " + _
" ZD.DescriptionSection, " + _
" ZD.Tier, " + _
" ZD.NbSection, " + _
" ZD.NoIdentification " + _
"FROM StoreProfile SP LEFT OUTER JOIN ZoneDescription ZD " + _
"ON (SP.Brand = ZD.Brand " + _
"AND SP.StoreNumber = ZD.StoreNumber) " + _
"WHERE SP.Brand = '" & Trim(strBrand) & "' " + _
"AND SP.StoreNumber = " & Trim(strStoreNumber) & " "
MyCommand = New OleDbCommand(strSql, MyConnection)
MyAdapter.SelectCommand = MyCommand
dsDescription.Clear()
MyAdapter.Fill(dsDescription, "Description")
If dsDescription.Tables(0).Rows.Count > 0 Then
'On rempli le dataGrid
Dim bindingSourceEmployee As BindingSource
bindingSourceEmployee = New BindingSource(dsDescription, "Description")
Me.dgDescriptionZone.DataSource = bindingSourceEmployee
End If
Catch ex As Exception
MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
End Sub
Es-ce que quelqu'un peut me dire mon erreur ?
Merci de votre aide
Partager