Bonjour,
Malgré mes recherches sur le forum et mes tutoriaux, je ne trouve pas la réponse à mon problème.
Je fais un programme qui gère des données stockées en local dans une DB Access. J'utilise un DataSet fortement typé dont les colonnes reprennent la structure de la base (type de données notamment). Ce DataSet alimente un DataGrid. Lorsque je crée une nouvelle entrée, celle-ci s'affiche bien dans le DataGrid mais lorsque j'appelle un dta.Update, j'obtiens une OLEDB Exception "Type de données incompatible dans l'expression du critère." dont voici le 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)
à Carnet_de_vol.DataSetCarnetTableAdapters.VolsTableAdapter.Update(VolsDataTable dataTable) dans C:\Users\Christophe\Documents\Visual Studio 2010\Projects\Carnet de vol\Carnet de vol\DataSetCarnet.Designer.vb:ligne 3104
à Carnet_de_vol.FormMain.Button1_Click(Object sender, EventArgs e) dans C:\Users\Christophe\Documents\Visual Studio 2010\Projects\Carnet de vol\Carnet de vol\FormMain.vb:ligne 213
à System.Windows.Forms.Control.OnClick(EventArgs e)
à System.Windows.Forms.Button.OnClick(EventArgs e)
à System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
à System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
à System.Windows.Forms.Control.WndProc(Message& m)
à System.Windows.Forms.ButtonBase.WndProc(Message& m)
à System.Windows.Forms.Button.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(IntPtr 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)
à Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()
à Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()
à Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)
à Carnet_de_vol.My.MyApplication.Main(String[] Args) dans 17d14f5c-a337-4978-8281-53493378c1071.vb:ligne 81
à System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
à System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
à Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
à System.Threading.ThreadHelper.ThreadStart_Context(Object state)
à System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
à System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
à System.Threading.ThreadHelper.ThreadStart()
Je bidouille ma requête SQL INSERT pour tester la colonne qui plante et il s'agit des colonnes contenant des données de type "Decimal". Ca ne plante pas lorsque la donnée créée est un entier. Je suspecte donc un mauvais comportement du DataAdapter qui ne convertit pas les données Decimal en format US (1.32 au lieu de 1,32) ? Je suppose que j'aurais la même chose en UPDATE... Le problème semble connu mais je n'arrive pas à le contourner. Quelqu'un peut-il confirmer et me proposer une solution ?
Merci d'avance
Partager