IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Windows Forms Discussion :

un Oledbcommandbuilder qui bloque


Sujet :

Windows Forms

Vue hybride

Message précédent Message précédent   Message suivant Message suivant
  1. #1
    Membre éclairé Avatar de elghadi_mohamed
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Décembre 2005
    Messages
    227
    Détails du profil
    Informations personnelles :
    Sexe : Homme

    Informations professionnelles :
    Activité : Ingénieur développement logiciels
    Secteur : Service public

    Informations forums :
    Inscription : Décembre 2005
    Messages : 227
    Par défaut un Oledbcommandbuilder qui bloque
    Bonjour

    je suis en projet pour la mise en place d'un fornulaire de banque mais j'ai des lacunes :

    j'utilise une petite BD access je suis arrive à faire une recherche dans la BD et de faire des nouveaux enregistrement dans la table de la BD mais mon probleme figure dans la modification d'un enregistrement existant ce qui fait bloquer l'application voici quelques details de l'erreur que j'ai eu :


    le stacktrace de l'erreur:
    System.Data.OleDb.OleDbException was unhandled
    ErrorCode=-2147217900
    Message="Erreur de syntaxe (opérateur absent) dans l'expression '(((? = 1 AND TypeDeMessage IS NULL) OR (TypeDeMessage = ?)) AND ((? = 1 AND Destinataire IS NULL) OR (Destinataire = ?)) AND (M20 = ?) AND ((? = 1 AND M23ADate IS NULL) OR (M23ADate = ?)) AND ((? = 1 AND M23ADevise IS NULL) OR (M23ADevise = ?)) AND ((? = '."
    Source="Microsoft JET Database Engine"
    StackTrace:
    at System.Data.Common.DbDataAdapter.UpdatedRowStatusErrors(RowUpdatedEventArgs rowUpdatedEvent, BatchCommandInfo[] batchCommands, Int32 commandCount)
    at System.Data.Common.DbDataAdapter.UpdatedRowStatus(RowUpdatedEventArgs rowUpdatedEvent, BatchCommandInfo[] batchCommands, Int32 commandCount)
    at System.Data.Common.DbDataAdapter.Update(DataRow[] dataRows, DataTableMapping tableMapping)
    at System.Data.Common.DbDataAdapter.UpdateFromDataTable(DataTable dataTable, DataTableMapping tableMapping)
    at System.Data.Common.DbDataAdapter.Update(DataSet dataSet, String srcTable)
    at Swift2.Module1.enregister(Enregistrement& swifts, Sw& forme) in C:\Documents and Settings\Mohamed\Bureau\Visual Basic\Projets\VB8\Swift2\Swift2\Module1.vb:line 336
    at Swift2.MDIParent1.SaveToolStripButton_Click(Object sender, EventArgs e) in C:\Documents and Settings\Mohamed\Bureau\Visual Basic\Projets\VB8\Swift2\Swift2\MDIParent1.vb:line 114
    at System.Windows.Forms.ToolStripItem.RaiseEvent(Object key, EventArgs e)
    at System.Windows.Forms.ToolStripButton.OnClick(EventArgs e)
    at System.Windows.Forms.ToolStripItem.HandleClick(EventArgs e)
    at System.Windows.Forms.ToolStripItem.HandleMouseUp(MouseEventArgs e)
    at System.Windows.Forms.ToolStripItem.FireEventInteractive(EventArgs e, ToolStripItemEventType met)
    at System.Windows.Forms.ToolStripItem.FireEvent(EventArgs e, ToolStripItemEventType met)
    at System.Windows.Forms.ToolStrip.OnMouseUp(MouseEventArgs mea)
    at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
    at System.Windows.Forms.Control.WndProc(Message& m)
    at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
    at System.Windows.Forms.ToolStrip.WndProc(Message& m)
    at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
    at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
    at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
    at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
    at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
    at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
    at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
    at System.Windows.Forms.Application.Run(ApplicationContext context)
    at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()
    at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()
    at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)
    at Swift2.My.MyApplication.Main(String[] Args) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 81
    at System.AppDomain.nExecuteAssembly(Assembly assembly, String[] args)
    at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
    at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
    at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
    at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
    at System.Threading.ThreadHelper.ThreadStart()
    sachant que pour faire cette commande(modifications d'enregistrement existant) j'utilise les memes objets que pour cree un nouveau enregistrement - je fais les 2 operations dans la meme fonction - il y a juste un IF ELSE qui fait la difference et pourtant ça ne plante que pour la modification :

    voici une partie du code :
    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
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
     
    Dim Nblignes As Integer
            Dim Connexion As OleDbConnection
            Dim Commande As OleDbCommand
            Dim Adapter As OleDbDataAdapter
            Dim Conteneur As New DataSet()
            Dim Table As DataTable
            Dim ligne As DataRow
            Dim compilateur As OleDbCommandBuilder
            Connexion = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data source=" + DBname)
            Commande = New OleDbCommand("Select * from Swift")
            Connexion.Open()
            Adapter = New OleDbDataAdapter(Commande)
            Commande.Connection() = Connexion
            Adapter.Fill(Conteneur, "Swift")
            Table = Conteneur.Tables("Swift")
            M20 = forme.TextBox3.Text
            If remplirClass(swifts, forme, 1) Then
    'dans le cas d'une modification
                For Nblignes = 0 To Table.Rows.Count - 1
                    If Table.Rows(Nblignes).Item("M20") = M20 Then
                        ligne = Conteneur.Tables("Swift").Rows(Nblignes)
                        ligne("TypeDeMessage") = swifts.Type_de_message
     
                        ligne("Destinataire") = forme.TextBox2.Text
     
     
                        ligne("M23ADate") = swifts.M23A_date
                        ligne("M23ADevise") = swifts.M23A_devise
                        ligne("M23Montant") = swifts.M23A_montant
                        ligne("M50K") = swifts.M50K
                        ligne("BanqueInter") = swifts.Banque_inter
                        ligne("O57A") = swifts.O57A
                        ligne("O57D") = swifts.O57D
                        ligne("M59") = swifts.M59
                        ligne("O70") = swifts.O70
                        ligne("71A") = swifts._71A
                        Exit For
                    End If
                Next
            Else
    ' dans le cas d'un nouveau enregistrement
                ligne = Conteneur.Tables("Swift").NewRow()
                ligne("TypeDeMessage") = swifts.Type_de_message
                ligne("Destinataire") = swifts.Destinataires
                ligne("M20") = swifts.M20
                ligne("M23ADate") = swifts.M23A_date
                ligne("M23ADevise") = swifts.M23A_devise
                ligne("M23Montant") = swifts.M23A_montant
                ligne("M50K") = swifts.M50K
                ligne("BanqueInter") = swifts.Banque_inter
                ligne("O57A") = swifts.O57A
                ligne("O57D") = swifts.O57D
                ligne("M59") = swifts.M59
                ligne("O70") = swifts.O70
                ligne("71A") = swifts._71A
                Conteneur.Tables("Swift").Rows.Add(ligne)
                End If
            compilateur = New OleDbCommandBuilder(Adapter)
    ' l'erreur ce declenche à ce niveau
            Adapter.Update(Conteneur, "Swift")
            Connexion.Close()
            Commande = Nothing
            Adapter = Nothing
            Conteneur = Nothing
            Table = Nothing
            ligne = Nothing


    je travaille sur VISUAL STUDIO 2005 Pro
    merci pour votre aide

  2. #2
    Membre éclairé Avatar de elghadi_mohamed
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Décembre 2005
    Messages
    227
    Détails du profil
    Informations personnelles :
    Sexe : Homme

    Informations professionnelles :
    Activité : Ingénieur développement logiciels
    Secteur : Service public

    Informations forums :
    Inscription : Décembre 2005
    Messages : 227
    Par défaut
    Pas une reponse

    s'il vous plait un coup de main c'est important

  3. #3
    Membre éclairé Avatar de elghadi_mohamed
    Homme Profil pro
    Ingénieur développement logiciels
    Inscrit en
    Décembre 2005
    Messages
    227
    Détails du profil
    Informations personnelles :
    Sexe : Homme

    Informations professionnelles :
    Activité : Ingénieur développement logiciels
    Secteur : Service public

    Informations forums :
    Inscription : Décembre 2005
    Messages : 227
    Par défaut
    dans le code que j'ai fournis le mot "swifts" correspond à une classe qui contient les donnees en provenance de la BD

    je ne sais pas exactement le probleme mais j'ai deja fait la meme manipulation sur une autre BD avec effacement et ça marchait !!

    je peux enregistrer correctement et faire une recherche mais une suppression ni une mise à jour d'un champ ?!

    si quelqu'un connait une autre methode pour la mise à jour d'une BD autre que le DATASET je suis impatient de la connaitre ?!

    merci

Discussions similaires

  1. Spyware qui bloque le fond d'écran Windows
    Par akli_agha dans le forum Sécurité
    Réponses: 6
    Dernier message: 02/02/2006, 17h16
  2. pc qui bloque et message du BIOS
    Par ouldfella dans le forum Ordinateurs
    Réponses: 4
    Dernier message: 13/10/2005, 14h22
  3. Réponses: 3
    Dernier message: 22/07/2005, 15h16
  4. [MFC] fonction ReadFile qui bloque
    Par r0d dans le forum MFC
    Réponses: 9
    Dernier message: 15/04/2005, 13h21
  5. Réponses: 6
    Dernier message: 21/03/2005, 13h22

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo