StrataFrame Forum

Maintenance Form Tool Strip Greyed Except for New

http://forum.strataframe.net/Topic22613.aspx

By GGP - 4/2/2009

I'm a newbie user and I've created a Maintenance Form with a Business Object and I put in 6 textbox fields the same way the demo shows.   When the form appears,  all of the buttons on the MaintenanceFormToolStrip are greyed out except I have an option to add 'New' items to the database.  This is a populated MS Access DB with an autogenerated Primary Key.  I'm using a ODBC connection. 

If I choose to add New data just for the heck of it, I get the following exceptions.   

MicroFour.StrataFrame.Business.BusinessLayerException was unhandled
  Message="An error occurred while saving an the data to the server."
  Source="MicroFour StrataFrame Business"
  StackTrace:
       at MicroFour.StrataFrame.Business.BusinessLayer.SaveByForm(Boolean Transactional, String TransactionKey)
       at MicroFour.StrataFrame.UI.Windows.Forms.BaseForm.Save(Boolean Transactional, String TransactionKey)
       at MicroFour.StrataFrame.UI.Windows.Forms.BaseForm.Save()
       at MicroFour.StrataFrame.UI.Windows.Forms.MaintenanceFormToolStrip.cmdSave_Click(Object sender, EventArgs e)
       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 WindowsApplication1.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()
  InnerException: MicroFour.StrataFrame.Data.DataLayerException
       Message="An error occurred while creating a new DataLayer for the business object."
       Source="MicroFour StrataFrame Business"
       StackTrace:
            at MicroFour.StrataFrame.Business.BusinessLayer.get__DataLayer()
            at MicroFour.StrataFrame.Business.BusinessLayer.SaveByForm(Boolean Transactional, String TransactionKey)
       InnerException: MicroFour.StrataFrame.Data.DataLayerException
            Message="The DataSourceKey [] is not defined."
            Source="MicroFour StrataFrame Business"
            StackTrace:
                 at MicroFour.StrataFrame.Data.DataLayer.Create(BusinessLayer BusinessObject, ISynchronizeInvoke SyncObject, Boolean CheckDesignTime)
                 at MicroFour.StrataFrame.Business.BusinessLayer.get__DataLayer()
            InnerException: 

I have a funny feeling this is going to be very obvious,  but I think I need another pair of eyes!

By Greg McGuffey - 4/2/2009

The inner exception likely provides the key:



InnerException: MicroFour.StrataFrame.Data.DataLayerException

Message="The DataSourceKey [] is not defined."

Source="MicroFour StrataFrame Business"




I'm guessing this means that it can't find the default data source, which has a key of "" (empty string). So, did you define your data source(s) in the SetDataSources event handler is AppMain.vb (programs.cs for C#)? What key did you use for the datasource(s)? Did you setup your BOs to use the appropriate key?
By Trent L. Taylor - 4/4/2009

Greg is correct. You havn't setup your connection for thsi data source.  You will add this in the Appmain.vb or program.cs file in the SetDataSources method.  You can also refer the docs on this as well.