Updating BO causes Business layer exception


Author
Message
Doug Birtell
Doug Birtell
StrataFrame Beginner (33 reputation)StrataFrame Beginner (33 reputation)StrataFrame Beginner (33 reputation)StrataFrame Beginner (33 reputation)StrataFrame Beginner (33 reputation)StrataFrame Beginner (33 reputation)StrataFrame Beginner (33 reputation)StrataFrame Beginner (33 reputation)StrataFrame Beginner (33 reputation)
Group: Forum Members
Posts: 33, Visits: 64
I have created a windows form that maintains a simple table in a SQL Server database.  The first column of this table is also the primary key.

I can add new records to the business object (and underlying table) but when I try to update one of the existing records I get the following error.  The problem table only was one column as the primary key and it is not an identity column (auto generated).  Looking at the partial BO class, it appears that the correct column is being used as the primary key.

BusinessLayerException

  An error occurred while saving an the data to the server.

DataLayerSavingException

  Cannot create UPDATE command because the updating DataTable does not contain columns for all PrimaryKeyFields.

DataLayerException

  Cannot create UPDATE command because the updating DataTable does not contain columns for all PrimaryKeyFields.

 

Source     : MicroFour StrataFrame Business

 

Stack Trace:

   at MicroFour.StrataFrame.Data.DataLayer.BuildUpdateInfo(DataTable UpdatingTable, Boolean Transactional, String TransactionKey)

   at MicroFour.StrataFrame.Data.DataLayer.UpdateDataTableThread(Object ThreadParams)

   at MicroFour.StrataFrame.Data.DataLayer.SaveByForm(DataTable TableToSave, Boolean Transactional, String TransactionKey)

   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.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Threaded View
Threaded View
Doug Birtell - 17 Years Ago
Trent L. Taylor - 17 Years Ago
Doug Birtell - 17 Years Ago
Trent L. Taylor - 17 Years Ago
Doug Birtell - 17 Years Ago
                         Doug,

This statement simply exports all the sql that is...
Greg McGuffey - 17 Years Ago
                             Oh, and as to your confusion about SetDebugOn, this is a method of a...
Greg McGuffey - 17 Years Ago
                                 Greg, Thanks for the explaination. I modified the code to log the sql...
Doug Birtell - 17 Years Ago
                                     Well, I think Ben will likely have to help you. It doesn't appear to...
Greg McGuffey - 17 Years Ago
                                         Thanks Greg. It makes sense that it's some generated code someplace...
Doug Birtell - 17 Years Ago
                                             Hehe, sorry for the delay, been digging at the pile on my desk :) OK,...
StrataFrame Team - 17 Years Ago
                                                 Ben, I understand what you are saying. Every where I look, I see the...
Doug Birtell - 17 Years Ago
                                                     When you're at that break point in the BeforeSave, check these values...
StrataFrame Team - 17 Years Ago
                                                         Ben, I've attached a word document with screenshots that hopefully...
Doug Birtell - 17 Years Ago
                                                             What do you get in the Watch window when you test...
StrataFrame Team - 17 Years Ago
                                                                 Ben, I'm afraid I get true. see attached... Doug
Doug Birtell - 17 Years Ago
                                                         The thing that pops out to me is that you are allowing NULLs in your...
Greg McGuffey - 17 Years Ago
                                                             I understand and agree totally about the PK not being null. I had the...
Doug Birtell - 17 Years Ago
                                                                 I wouldn't say terribly wrong...there's just lots of moving pieces and...
Greg McGuffey - 17 Years Ago
                                                                     Greg, I'm tracking 100% with what you posted. The PK is entered by...
Doug Birtell - 17 Years Ago
                                                                         OK, do you have a small sample app that reproduces the problem? Say,...
StrataFrame Team - 17 Years Ago
                                                                             I am in the process of creating a small sample app of the problem....
Doug Birtell - 17 Years Ago
                                                                             Ok, I've created a small app that has the following characteristics...
Doug Birtell - 17 Years Ago
                                                                                 Ben, At this point, I think I will throw away the "problem child" and...
Doug Birtell - 17 Years Ago
                                                                                     The reason you're getting the InvalidCastException is because SF does...
StrataFrame Team - 17 Years Ago
                                                                                         Ben, Thanks for the explaination. That all makes sense now. I'll let...
Doug Birtell - 17 Years Ago
                                                                                             Trent, Greg, Ben, I recreated the form, BO, etc from scratch, and all...
Doug Birtell - 17 Years Ago
                                                                                                 Glad you got it working. I've had a few problems like that and they...
Greg McGuffey - 17 Years Ago
                                                                                                     No problem, glad you got it working :)
StrataFrame Team - 17 Years Ago

Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search