Unfriendly SQL exception error message


Author
Message
Tiong Diu King
Tiong Diu King
StrataFrame Beginner (30 reputation)StrataFrame Beginner (30 reputation)StrataFrame Beginner (30 reputation)StrataFrame Beginner (30 reputation)StrataFrame Beginner (30 reputation)StrataFrame Beginner (30 reputation)StrataFrame Beginner (30 reputation)StrataFrame Beginner (30 reputation)StrataFrame Beginner (30 reputation)
Group: Forum Members
Posts: 28, Visits: 70
Hi all,



Strataframe is prompt the unfriendly sql exception error message when the database integrity is violated.



Can someone share the knowledge how do you people handle this case...





Many thanks
Greg McGuffey
Greg McGuffey
Strategic Support Team Member (3.3K reputation)
Group: Forum Members
Posts: 2K, Visits: 6.6K
I'm not clear on what the error might be. Could you provide some more details as to the situations that created the error (what actions were being taken on what data) and what exactly the error was and a stack trace if possible. Thanks!
Tiong Diu King
Tiong Diu King
StrataFrame Beginner (30 reputation)StrataFrame Beginner (30 reputation)StrataFrame Beginner (30 reputation)StrataFrame Beginner (30 reputation)StrataFrame Beginner (30 reputation)StrataFrame Beginner (30 reputation)StrataFrame Beginner (30 reputation)StrataFrame Beginner (30 reputation)StrataFrame Beginner (30 reputation)
Group: Forum Members
Posts: 28, Visits: 70
BusinessLayerException

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

DataLayerSavingException

The INSERT statement conflicted with the FOREIGN KEY SAME TABLE constraint "FK_hrrsCompany_hrrsCompany". The conflict occurred in database "SPMSNET", table "dbo.hrssCompany", column 'iCompany_PK'.

The statement has been terminated.

SqlException

The INSERT statement conflicted with the FOREIGN KEY SAME TABLE constraint "FK_hrrsCompany_hrrsCompany". The conflict occurred in database "SPMSNET", table "dbo.hrssCompany", column 'iCompany_PK'.

The statement has been terminated.



Source : MicroFour StrataFrame Business



Stack Trace:

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(CommandBehavior behavior)

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)

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)

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)







What even offense of Sql integrity, Strataframe prompt the message as above. It's good understanding for the developer but not for the end user.

Is that any other way for us to catch this kind of sql exception and prompt our own friendly message?
Ivan George Borges
Ivan George Borges
Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)
Group: StrataFrame MVPs
Posts: 1.9K, Visits: 21K
Hi Tiong.

What even offense of Sql integrity, Strataframe prompt the message as above. It's good understanding for the developer but not for the end user.
Is that any other way for us to catch this kind of sql exception and prompt our own friendly message?

Have a look at your AppMain.vb/Program.cs and check the UnhandledExceptionFound method right at the end of it.

Tiong Diu King
Tiong Diu King
StrataFrame Beginner (30 reputation)StrataFrame Beginner (30 reputation)StrataFrame Beginner (30 reputation)StrataFrame Beginner (30 reputation)StrataFrame Beginner (30 reputation)StrataFrame Beginner (30 reputation)StrataFrame Beginner (30 reputation)StrataFrame Beginner (30 reputation)StrataFrame Beginner (30 reputation)
Group: Forum Members
Posts: 28, Visits: 70
Get it and thanks for your help...
Ivan George Borges
Ivan George Borges
Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)Strategic Support Team Member (3.5K reputation)
Group: StrataFrame MVPs
Posts: 1.9K, Visits: 21K
You're welcome. Wink
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