![Citation](https://forum.developpez.be/images/misc/quote_icon.png)
Envoyé par
infosam76
Voir une partie du code nous aiderais beaucoup pour te dépanner.
chaîne de connections :
Public con As New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=|DataDirectory|\MINI_GStock1.accdb")
1 2 3 4 5 6 7 8 9 10
|
Public Sub remplire(ByVal table As String)
Try
ds.Clear()
da = New OleDbDataAdapter("select * from " & table & "", con)
da.Fill(ds, table)
Catch ex As Exception
MsgBox("Erreur dans la Fonction de Remplissage dataset !!! ")
End Try
End Sub |
la procédure d'insertion :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
| Public Sub DB_Insert(ByVal table As String, ByVal val() As String)
Try
remplire(table)
dr = ds.Tables(table).NewRow()
For i As Integer = 0 To val.Length - 1
dr(i + 1) = val(i).ToString
Next
ds.Tables(table).Rows.Add(dr)
cmdb = New OleDbCommandBuilder(da)
da.Update(ds, table)
ds.Clear()
MsgBox("ajoute Reussie !", MsgBoxStyle.Information)
Catch ex As Exception
MsgBox("Erreur dans la requête d'Insertion !!! ")
End Try
End Sub |
Remarque :
je travail en mode déconnecter ...
Partager