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 :

Problème pour sauvegarder mes données


Sujet :

Windows Forms

  1. #1
    Futur Membre du Club
    Inscrit en
    Novembre 2006
    Messages
    14
    Détails du profil
    Informations forums :
    Inscription : Novembre 2006
    Messages : 14
    Points : 9
    Points
    9
    Par défaut Problème pour sauvegarder mes données
    Bonjour,
    Voilà j 'ai réalisé une appalication vb + access, donc je lis et modifie ma base de données , donc j 'ai ma commande :

    Me.DonneesTableAdapter.Update(Me.BaseDataSet.Donnees)

    Donc si je rajoute des élement et que j'enregistre , j ai pas de problèmes , mais si je refait des changements et que j'execute ma commande une deuxième fois , j'ai un message d'erreur , qui est le suivant :

    Violation de l'accès concurrentiel : UpdateCommand a affecté 0 des enregistrements 1 attendus.

    et plus précisement :


    L'exception System.Data.DBConcurrencyException n'a pas été gérée
    Message="Violation de l'accès concurrentiel : UpdateCommand a affecté 0 des enregistrements 1 attendus."
    RowCount=1
    Source="System.Data"
    StackTrace:
    à System.Data.Common.DbDataAdapter.UpdatedRowStatusErrors(RowUpdatedEventArgs rowUpdatedEvent, BatchCommandInfo[] batchCommands, Int32 commandCount)
    à System.Data.Common.DbDataAdapter.UpdatedRowStatus(RowUpdatedEventArgs rowUpdatedEvent, BatchCommandInfo[] batchCommands, Int32 commandCount)
    à System.Data.Common.DbDataAdapter.Update(DataRow[] dataRows, DataTableMapping tableMapping)
    à System.Data.Common.DbDataAdapter.UpdateFromDataTable(DataTable dataTable, DataTableMapping tableMapping)
    à System.Data.Common.DbDataAdapter.Update(DataTable dataTable)
    à Davidson.baseDataSetTableAdapters.DonneesTableAdapter.Update(DonneesDataTable dataTable) dans C:\Tmp\davidson3\davidson\baseDataSet.Designer.vb:ligne 5082
    à Davidson.Form1.DonneesBindingNavigatorSaveItem_Click_1(Object sender, EventArgs e) dans C:\Tmp\davidson3\davidson\Form1.vb:ligne 111
    à System.Windows.Forms.ToolStripItem.RaiseEvent(Object key, EventArgs e)
    à System.Windows.Forms.ToolStripButton.OnClick(EventArgs e)
    à System.Windows.Forms.ToolStripItem.HandleClick(EventArgs e)
    à System.Windows.Forms.ToolStripItem.HandleMouseUp(MouseEventArgs e)
    à System.Windows.Forms.ToolStripItem.FireEventInteractive(EventArgs e, ToolStripItemEventType met)
    à System.Windows.Forms.ToolStripItem.FireEvent(EventArgs e, ToolStripItemEventType met)
    à System.Windows.Forms.ToolStrip.OnMouseUp(MouseEventArgs mea)
    à System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
    à System.Windows.Forms.Control.WndProc(Message& m)
    à System.Windows.Forms.ScrollableControl.WndProc(Message& m)
    à System.Windows.Forms.ToolStrip.WndProc(Message& m)
    à System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
    à System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
    à System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
    à System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
    à System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
    à System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
    à System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
    à System.Windows.Forms.Form.ShowDialog(IWin32Window owner)
    à System.Windows.Forms.Form.ShowDialog()
    à Davidson.LoginForm1.OK_Click(Object sender, EventArgs e) dans C:\Tmp\davidson3\davidson\LoginForm1.vb:ligne 26
    à System.Windows.Forms.Control.OnClick(EventArgs e)
    à System.Windows.Forms.Button.OnClick(EventArgs e)
    à System.Windows.Forms.Button.PerformClick()
    à System.Windows.Forms.Form.ProcessDialogKey(Keys keyData)
    à System.Windows.Forms.TextBoxBase.ProcessDialogKey(Keys keyData)
    à System.Windows.Forms.Control.PreProcessMessage(Message& msg)
    à System.Windows.Forms.Control.PreProcessControlMessageInternal(Control target, Message& msg)
    à System.Windows.Forms.Application.ThreadContext.PreTranslateMessage(MSG& msg)
    à System.Windows.Forms.Application.ThreadContext.System.Windows.Forms.UnsafeNativeMethods.IMsoComponent.FPreTranslateMessage(MSG& msg)
    à System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
    à System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
    à System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
    à System.Windows.Forms.Application.Run(ApplicationContext context)
    à Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()
    à Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()
    à Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)
    à Davidson.My.MyApplication.Main(String[] Args) dans 17d14f5c-a337-4978-8281-53493378c1071.vb:ligne 81
    à System.AppDomain.nExecuteAssembly(Assembly assembly, String[] args)
    à System.Runtime.Hosting.ManifestRunner.Run(Boolean checkAptModel)
    à System.Runtime.Hosting.ManifestRunner.ExecuteAsAssembly()
    à System.Runtime.Hosting.ApplicationActivator.CreateInstance(ActivationContext activationContext, String[] activationCustomData)
    à System.Runtime.Hosting.ApplicationActivator.CreateInstance(ActivationContext activationContext)
    à Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssemblyDebugInZone()
    à System.Threading.ThreadHelper.ThreadStart_Context(Object state)
    à System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
    à System.Threading.ThreadHelper.ThreadStart()

    Donc si quelqu'un connaît la raison de ce problème , je suis preneur d'une eventuelle solution.

    Merci

  2. #2
    Expert éminent
    Avatar de bidou
    Homme Profil pro
    Développeur .NET
    Inscrit en
    Mai 2002
    Messages
    3 055
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 57
    Localisation : France, Rhône (Rhône Alpes)

    Informations professionnelles :
    Activité : Développeur .NET
    Secteur : Transports

    Informations forums :
    Inscription : Mai 2002
    Messages : 3 055
    Points : 7 962
    Points
    7 962
    Par défaut
    Pas la peine de nous copier toute l'exception, le message suffit

    Donc cela veut dire que la commande ne sait plus identifier l'enregistrement puisque tu l'as modifié précédemment. Probablement que ta propriété AcceptChangesDuringUpdate ne doit pas être vrai.

  3. #3
    Futur Membre du Club
    Inscrit en
    Novembre 2006
    Messages
    14
    Détails du profil
    Informations forums :
    Inscription : Novembre 2006
    Messages : 14
    Points : 9
    Points
    9
    Par défaut ?
    Ou est ce que je peux changer la valeur de acceptchangeDuringupdate ? car sur mes textbox je n ai pas de propriété ressemblant a ca .

  4. #4
    Expert éminent
    Avatar de bidou
    Homme Profil pro
    Développeur .NET
    Inscrit en
    Mai 2002
    Messages
    3 055
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 57
    Localisation : France, Rhône (Rhône Alpes)

    Informations professionnelles :
    Activité : Développeur .NET
    Secteur : Transports

    Informations forums :
    Inscription : Mai 2002
    Messages : 3 055
    Points : 7 962
    Points
    7 962
    Par défaut
    sur ton dataadapter

  5. #5
    Futur Membre du Club
    Inscrit en
    Novembre 2006
    Messages
    14
    Détails du profil
    Informations forums :
    Inscription : Novembre 2006
    Messages : 14
    Points : 9
    Points
    9
    Par défaut
    Quand je fais :

    Me.DonneesTableAdapter...

    Ben je n'ai pas de propriété acceptchangeduringupdate , comment je peux faire alors ?

  6. #6
    Expert éminent
    Avatar de bidou
    Homme Profil pro
    Développeur .NET
    Inscrit en
    Mai 2002
    Messages
    3 055
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 57
    Localisation : France, Rhône (Rhône Alpes)

    Informations professionnelles :
    Activité : Développeur .NET
    Secteur : Transports

    Informations forums :
    Inscription : Mai 2002
    Messages : 3 055
    Points : 7 962
    Points
    7 962
    Par défaut
    oui, dans les tableAdapter elle n'est pas accessible sauf en modifiant le code généré.
    Il faudrait testé si l'appel acceptChanges se fait bien, en appelant GetChanges après l'Update par exemple

Discussions similaires

  1. Quel Cloud pour sauvegarder mes base de données ?
    Par JauB dans le forum Cloud Computing
    Réponses: 1
    Dernier message: 18/02/2014, 19h39
  2. [Débutant] Problème pour sauvegarder des données.
    Par Justa_noob_at_MatLab dans le forum Interfaces Graphiques
    Réponses: 5
    Dernier message: 12/07/2013, 15h36
  3. Problème pour sauvegarder la base de données MySQL
    Par adrian07 dans le forum SugarCRM
    Réponses: 1
    Dernier message: 10/01/2012, 18h51
  4. Problème pour récupérer mes données XP sous Vista
    Par tortuegeniale65 dans le forum Windows Vista
    Réponses: 3
    Dernier message: 02/05/2007, 19h40
  5. Meilleur méthode pour stocker mes données
    Par cyberlewis dans le forum Windows
    Réponses: 6
    Dernier message: 03/07/2004, 11h53

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