Bonjour a tous.
Je vous explique mon problème, je travaille actuellement sur un logiciel déjà bien avancé, Pour compléter une fonction il m'est nécessaire d'effectué une suppression dans la base de donnée, j'ai donc a l'aide d'un objet de type OleDbCommand malheureusement la commande ne ce lance pas, le plus étrange c'est que d'autre commande s’exécute au dessus et en dessous de cette objet après avoir longuement cherché qu'elle pourrais être le problème j'ai finir par m'en remettre a vous. Je vous joint le code en dessous.
Donc la fonction d'insertion fonctionne correctement, la première fonction de suppression (celle que j'ai écrite) ne fonctionne pas tandis que les deux suivante fonctionne parfaitement.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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 'Instancier un objet Commande Obj_Command = New OleDbCommand() 'initialiser l'objet Command Obj_Command.Connection() = laConnection Obj_Command.CommandText = "INSERT INTO CONNEXION (CON_DATE, CON_EMP, CON_ACTION) VALUES ('" + Date.Now + "', '" + Form_Accueil.lbl_acc_login.Text + "', 'Suppression facture : " + Replace(tbx_fac_cli_rs.Text, "'", "''") + " - " + Replace(tbx_fac_cli_nom.Text, "'", "''") + " " + Replace(tbx_fac_cli_prenom.Text, "'", "''") + " - " + tbx_fac_cli_ttc.Text + " - " + mtbx_fac_cli_date.Text + "')" Obj_Command.ExecuteNonQuery() 'Instancier un objet Commande Obj_Command = New OleDbCommand() 'initialiser l'objet Command Obj_Command.Connection = laConnection Obj_Command.CommandText = "DELETE FROM LIGNE_ECRITURE WHERE LE_LIBELLE LIKE '*" + tbx_fac_cli_code.Text + "'" Obj_Command.ExecuteNonQuery() 'Instancier un objet Commande Obj_Command = New OleDbCommand() 'initialiser l'objet Command Obj_Command.Connection = laConnection Obj_Command.CommandText = "DELETE FROM FACTURE_CLIENT WHERE FA_ID=" + tbx_fac_cli_code.Text + "" Obj_Command.ExecuteNonQuery() 'Instancier un objet Commande Obj_Command = New OleDbCommand() 'initialiser l'objet Command Obj_Command.Connection = laConnection Obj_Command.CommandText = "DELETE FROM ACOMPTE WHERE FA_ID=" + tbx_fac_cli_code.Text + " AND AC_TYPE='Client'" Obj_Command.ExecuteNonQuery()
merci de m'avoir lu ^^.
Partager