1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
|
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
'1- Connection à la base ACCESS
Call ACCESSConnectionLoading()
Call ConnectionSourceACCESS("Tbl_Catégorisation")
'2- Ajout des nouveaux enregistrements
'Création de la nouvelle ligne de données dans la DataTable "TableDonnées_BaseBDD"
Dim NouvelEnregistrement As DataRow = dtt.NewRow()
With NouvelEnregistrement
.Item("Catégorie_Catégorisation") = "Le groupe de génie"
.Item("SousCatégorie_Catégorisation") = "Génial"
.Item("Commerçant_Catégorisation") = "Le Top"
.Item("LinkName_Catégorisation") = "Ca va le faire"
.Item("Matricule_Catégorisation") = "COM-09999"
.Item("Statut_Catégorisation") = "Actif"
'Ajout du nouvel évènement dans le DataTable : "TableDonnées_BaseBDD"
dtt.Rows.Add(NouvelEnregistrement)
End With
'3- Mise à jour des données dans la base de données Access
Dim Cmd As New OleDb.OleDbCommand
With Cmd
.CommandType = CommandType.Text
.Connection = ConnectionFichierSourceACCESS
.CommandType = CommandType.Text
.CommandText = "INSERT INTO Tbl_Catégorisation(Catégorie_Catégorisation = ? , SousCatégorie_Catégorisation = ?, Commerçant_Catégorisation = ?, LinkName_Catégorisation = ?, Matricule_Catégorisation = ?, Statut_Catégorisation = ?"
With .Parameters
.Add("@Catégorie_Catégorisation", OleDb.OleDbType.VarWChar, 255).Value = "Le groupe de génie"
.Add("@SousCatégorie_Catégorisation", OleDb.OleDbType.VarWChar, 255).Value = "Génial"
.Add("@Commerçant_Catégorisation", OleDb.OleDbType.VarWChar, 255).Value = "Le Top"
.Add("@LinkName_Catégorisation", OleDb.OleDbType.VarWChar, 255).Value = "Ca va le faire"
.Add("@Matricule_Catégorisation", OleDb.OleDbType.VarWChar, 255).Value = "COM-09999"
.Add("@Statut_Catégorisation", OleDb.OleDbType.VarWChar, 255).Value = "Actif"
End With
.ExecuteNonQuery()
End With
'4- Fermeture de la source
ConnectionFichierSourceACCESS.Close()
End Sub |
Partager