Bonjour,


Je souhaite créer des expressions dans DataColumn. Mais j'obtiens cette erreur à chaque fois :


Code :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
L'exception System.InvalidOperationException n'a pas été gérée
  Message="Le mappage de colonnes de SourceColumn 'DateFutur' a échoué car le DataColumn 'DateFutur' est une colonne calculée."
  Source="System.Data"
  StackTrace:
       à System.Data.Common.DataColumnMapping.GetDataColumnBySchemaAction(String sourceColumn, String dataSetColumn, DataTable dataTable, Type dataType, MissingSchemaAction schemaAction)    à System.Data.Common.DataColumnMapping.GetDataColumnBySchemaAction(DataTable dataTable, Type dataType, MissingSchemaAction schemaAction)    à System.Data.Common.DataColumnMappingCollection.GetDataColumn(DataColumnMappingCollection columnMappings, String sourceColumn, Type dataType, DataTable dataTable, MissingMappingAction mappingAction, MissingSchemaAction schemaAction)    à System.Data.Common.DataTableMapping.GetDataColumn(String sourceColumn, Type dataType, DataTable dataTable, MissingMappingAction mappingAction, MissingSchemaAction schemaAction)    à System.Data.ProviderBase.SchemaMapping.SetupSchemaWithoutKeyInfo(MissingMappingAction mappingAction, MissingSchemaAction schemaAction, Boolean gettingData, DataColumn parentChapterColumn, Object chapterValue)    à System.Data.ProviderBase.SchemaMapping..ctor(DataAdapter adapter, DataSet dataset, DataTable datatable, DataReaderContainer dataReader, Boolean keyInfo, SchemaType schemaType, String sourceTableName, Boolean gettingData, DataColumn parentChapterColumn, Object parentChapterValue)    à System.Data.Common.DataAdapter.FillMapping(DataSet dataset, DataTable datatable, String srcTable, DataReaderContainer dataReader, Int32 schemaCount, DataColumn parentChapterColumn, Object parentChapterValue)    à System.Data.Common.DataAdapter.FillFromReader(DataSet dataset, DataTable datatable, String srcTable, DataReaderContainer dataReader, Int32 startRecord, Int32 maxRecords, DataColumn parentChapterColumn, Object parentChapterValue)    à System.Data.Common.DataAdapter.Fill(DataTable[] dataTables, IDataReader dataReader, Int32 startRecord, Int32 maxRecords)    à System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior)    à System.Data.Common.DbDataAdapter.Fill(DataTable[] dataTables, Int32 startRecord, Int32 maxRecords, IDbCommand command, CommandBehavior behavior)    à System.Data.Common.DbDataAdapter.Fill(DataTable dataTable)    à Gestion_Des_Vibrations.Gestion_des_VibrationsDataSetTableAdapters.InstallationTableAdapter.Fill(InstallationDataTable dataTable) dans E:\PROGRAMMATION\-- PROJET EN COURS --\Gestion Des Vibrations\Gestion Des Vibrations\Gestion_des_VibrationsDataSet.Designer.vb:ligne 2365    à Gestion_Des_Vibrations.FRM_PRINCIPALE.FRM_PRINCIPALE_Load(Object sender, EventArgs e) dans E:\PROGRAMMATION\-- PROJET EN COURS --\Gestion Des Vibrations\Gestion Des Vibrations\FRM_PRINCIPALE.vb:ligne 17    à System.EventHandler.Invoke(Object sender, EventArgs e)    à System.Windows.Forms.Form.OnLoad(EventArgs e)    à System.Windows.Forms.Form.OnCreateControl()    à System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)    à System.Windows.Forms.Control.CreateControl()    à System.Windows.Forms.Control.WmShowWindow(Message& m)    à System.Windows.Forms.Control.WndProc(Message& m)    à System.Windows.Forms.ScrollableControl.WndProc(Message& m)    à System.Windows.Forms.ContainerControl.WndProc(Message& m)    à System.Windows.Forms.Form.WmShowWindow(Message& m)    à System.Windows.Forms.Form.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.SafeNativeMethods.ShowWindow(HandleRef hWnd, Int32 nCmdShow)    à System.Windows.Forms.Control.SetVisibleCore(Boolean value)    à System.Windows.Forms.Form.SetVisibleCore(Boolean value)    à System.Windows.Forms.Control.set_Visible(Boolean value)    à 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)    à Gestion_Des_Vibrations.My.MyApplication.Main(String[] Args) dans 17d14f5c-a337-4978-8281-53493378c1071.vb:ligne 81    à System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)    à 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()
  InnerException:


De plus en trafiquant un peu j'ai rèussi à tester mon expression, mais celle-ci ne fonctionne pas : IIF(Etat_Vibratoire='A' and DateMesure <> "", DateMesure+120, DateMesure+30)


Ce que je souhaite atteindre :

1ère Expression...

SI Etat_Vibratoire = A et DateMesure n'est pas vide alors le résultat égale : DateMesure + (120 jours) sinon égale DateMesure + (30 jours)


2ème Expression...

Si DateFutur n'est pas vide alors le résultat égale : Date du jour - DateFutur


Voilà, si quelqu'un peux m'aider sur ces expressions et surtout sur l'exception du haut que je ne sais pas corriger, si besoin est...