Troubleshooting a SaveByForm Error


Author
Message
Bill Cunnien
Bill Cunnien
StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)
Group: Forum Members
Posts: 785, Visits: 3.6K
I added a new field to a table yesterday (very minor change).  After utilizing the BOM to update the BO, I rebuilt the app, then added the field to a maintenance form so that it could be updated.  The app was deployed.  Error reports started coming in this morning.  I am getting the following (all I do is click edit, then immediately click save. . . no changes to the data):

Stack Trace:
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)

Inner Exception (same as Source):
MicroFour StrataFrame Business

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

The error does not give me much to go on.  What are some ways that I could troubleshoot this error?

Thanks,
Bill

Trent Taylor
Trent Taylor
StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 7K
Manually call the Save on the BO and step into the Save (the SF source will have to be in debug mode).  But more than likely either the BO or the database is not up to date.  If you are using CRUD settings, make sure that your sprocs are up to date.  It will more than likely be something simple like that.
Bill Cunnien
Bill Cunnien
StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)
Group: Forum Members
Posts: 785, Visits: 3.6K
Thanks.  While "walking" the code, I ran into this Inner Exception:

A transport-level error has occurred when receiving results from the server. (provider: TCP Provider, error: 0 - An existing connection was forcibly closed by the remote host.)

I am not sure if I was taking too much time while making observations in code or there was actually a forced connection closure by the SQL Server.  I don't think I have ever experienced a transport-level error before.  Any thoughts?

Trent Taylor
Trent Taylor
StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 7K
This can come from all sorts of things....I mean a lot!  But one common error that I see in the field is a connection timeout.  If you call a sproc, update, query, etc. that is taking a long time, then this could happen.  Also,  if you are manually opening and closing connections, this can happen as well.  But without understanding your environment and code, there is absolutely no way for me to give you a straight answer.
Bill Cunnien
Bill Cunnien
StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)
Group: Forum Members
Posts: 785, Visits: 3.6K
I do not have anything special going on regarding the save on the BO.  I try to keep things as standard as possible, so I try to let the BO do all of the heavy lifting.  Running the debug again, hoping to enter the source code, then whipping through the _PrimaryKeyFields and _AllFieldsList variables about a million times, I got this new error message:

A severe error occurred on the current command.  The results, if any, should be discarded.\rA severe error occurred on the current command.  The results, if any, should be discarded.

Just reporting back what I am getting in hopes to narrow down my options.  Thanks, in advance, for any help and tips provided.

Btw, I may not be debugging properly in order to interact with the source.  What steps do I need to take to make sure that the source is available to me?  I have a C# application with the source code attached to my project (not checked to build but set for debug in config mgr)...is there more that I need to do or is there a potential conflict I need to resolve between C# and VB.NET?  Thanks.

Trent Taylor
Trent Taylor
StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 7K
I have a C# application with the source code attached to my project (not checked to build but set for debug in config mgr)...is there more that I need to do or is there a potential conflict I need to resolve between C# and VB.NET? 

You never really want to do that.  You are better off opening the source by itself (not adding it to your solution) and building it in debug mode.  Once in debug mode and the debug assemblies are referenced by your application, you will be able to step into the source without the SF source being a part of your solution...which like I said, you don't really want to do.

When a .NET assembly is built in debug mode, it will create a pdb file that contains all of the debug information.  Just add the debug assemblies to the GAC (which the AfterBuild.bat will do for you) and then get out of VS and come back in (your project).  You will then be able to step into the source.

Bill Cunnien
Bill Cunnien
StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)
Group: Forum Members
Posts: 785, Visits: 3.6K
I opened the SF source code solution, built it in debug mode (already selected) and received no errors.  I ran the AfterBuild.bat file and got a ton of files added to the source folder (odd).  I closed VS and when I reopened, I got a message about the SF add-in not loading.  I said 'No' to remove it.  But now, I have no SF menu.  I closed and reopened VS.  No dice.  SF menu is gone.  What do I need to do, now?
Trent Taylor
Trent Taylor
StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 7K
You should not have run the AfterBuild.bat manually...I have no idea what all may have happened if you did.  This is part of the Post Build events.

Just manually drag the SF assemblies into the GAC, you may want to delete the source and re-extract it so you don't have a bunch of junk in it.  You may also have to fix your StrataFrame.Addin file.  It will be in the following location on Vista:

C:\Users\YourUserName\AppData\Roaming\Microsoft\MSEnvShared\AddIns

And the contents will look something like this:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<Extensibility xmlns="http://schemas.microsoft.com/AutomationExtensibility">
 <HostApplication>
  <Name>Microsoft Visual Studio Macros</Name>
  <Version>9.0</Version>
 </HostApplication>
 <HostApplication>
  <Name>Microsoft Visual Studio</Name>
  <Version>9.0</Version>
 </HostApplication>
 <Addin>
  <FriendlyName>StrataFrame Add-In Manager</FriendlyName>
  <Description>Adds extended functionality to the Visual Studio development environment for teh MicroFour StrataFrame Application Framework and Database Management Toolkit.</Description>
  <AboutBoxDetails>For more information about MicroFour StrataFrame, visit our website at\rhttp://www.strataframe.net\rCopyright (c) 2005 MicroFour, Inc. Inc.</AboutBoxDetails>
  <Assembly>C:\Program Files\Common Files\MicroFour\StrataFrame\MicroFour StrataFrame AddIns.dll</Assembly>
  <FullClassName>MicroFour.StrataFrame.AddIns.AddInManager</FullClassName>
  <LoadBehavior>1</LoadBehavior>
  <CommandPreload>0</CommandPreload>
  <CommandLineSafe>0</CommandLineSafe>
 </Addin>
</Extensibility>

Depending upon how you answered the question when the failed add-in message came up, you will either need to set the LoadBehavior back to 1 or rename the add-in file (usually just need to remove the underscore).

Bill Cunnien
Bill Cunnien
StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)
Group: Forum Members
Posts: 785, Visits: 3.6K
Ok.  Got it going, again.  And, my code is now debugging into the source code.  This is what I get:

MicroFour.StrataFrame.Business.BusinessLayerException was unhandled by user code
  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.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
  InnerException: MicroFour.StrataFrame.Data.DataLayerSavingException
       Message="A severe error occurred on the current command.  The results, if any, should be discarded. A severe error occurred on the current command.  The results, if any, should be discarded."
       Source="MicroFour StrataFrame Business"
       StackTrace:
            at MicroFour.StrataFrame.Data.DataLayer.UpdateDataTable(DataTable TableToUpdate, Boolean Transactional, String TransactionKey)    at MicroFour.StrataFrame.Data.DataLayer.SaveByForm(DataTable TableToSave, Boolean Transactional, String TransactionKey)    at MicroFour.StrataFrame.Business.BusinessLayer.SaveByForm(Boolean Transactional, String TransactionKey)
       InnerException: System.Data.SqlClient.SqlException
            Class=11
            ErrorCode=-2146232060
            LineNumber=0
            Message="A severe error occurred on the current command.  The results, if any, should be discarded. A severe error occurred on the current command.  The results, if any, should be discarded."
            Number=0
            Procedure=""
            Server="SQL_SERVER"
            Source=".Net SqlClient Data Provider"
            State=0
            StackTrace:
                 at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection)    at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)    at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj)    at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj)    at System.Data.SqlClient.SqlDataReader.ConsumeMetaData()    at System.Data.SqlClient.SqlDataReader.get_MetaData()    at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)    at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async)    at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result)    at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)    at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior behavior, String method)    at System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior)    at System.Data.Common.DbCommand.ExecuteReader()    at MicroFour.StrataFrame.Data.DbDataSourceItem.InternalExecuteReader(DbCommand Command, Boolean IsTransactional, String TransactionKey)    at MicroFour.StrataFrame.Data.SqlDataSourceItem.UpdateRow(QueryInformation QueryInfo, DataRow RowToUpdate, ConcurrencyExceptionHandler ConcurrencyHandler, AddRowErrorHandler RowErrorHandler, Boolean RecreateCommand)    at MicroFour.StrataFrame.Data.DbDataSourceItem.UpdateRow(QueryInformation QueryInfo, DataRow RowToUpdate, ConcurrencyExceptionHandler ConcurrencyHandler, AddRowErrorHandler RowErrorHandler)    at MicroFour.StrataFrame.Data.DataLayer.UpdateDataTableThread(Object ThreadParams)
            InnerException:

It is "bombing" at line 4493 of businesslayer.vb (BusinessLayer Class).  I am looking into the SqlClient error to see if anything stands out there.

Bill

Bill Cunnien
Bill Cunnien
StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)StrataFrame VIP (1.2K reputation)
Group: Forum Members
Posts: 785, Visits: 3.6K
Like you said, Trent, the error could be caused by many different things.  I determined that the field itself was not correctly typed.  The new field was added as an nvarchar(4000) (SQL Server 2000).  Apparently, this does not like to play nicely with other data types in the neighborhood.  After changing it to varchar(800), the SaveByForm method worked perfectly.  Users can now save their data.  Oh, they are so happy, now!  Some are doing the riverdance in the hallways.  I think I will join them.  Hehe
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search