Arithmetic overflow error for data type tinyint, value = 427.


https://forum.kartris.com/Topic3636.aspx
Print Topic | Close Window

By nickdrye - Wed 25 Feb 2015
This is what I see when I visit my shop url - and I don't know why!


Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Data.SqlClient.SqlException: Arithmetic overflow error for data type tinyint, value = 427.

Source Error:

Line 2999:            End IfLine 3000:            Dim dataTable As kartrisProductsData.ProductsDataTable = New kartrisProductsData.ProductsDataTable()Line 3001:            Me.Adapter.Fill(dataTable)Line 3002:            Return dataTableLine 3003:        End Function

Source File: C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\root\0100f439\824b7280\App_Code.cmmgadpu.57.vb Line: 3001

Stack Trace:

[SqlException (0x80131904): Arithmetic overflow error for data type tinyint, value = 427.]   System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction) +388   System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose) +717   System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady) +4515   System.Data.SqlClient.SqlDataReader.TryHasMoreRows(Boolean& moreRows) +385   System.Data.SqlClient.SqlDataReader.TryReadInternal(Boolean setTimeout, Boolean& more) +502   System.Data.SqlClient.SqlDataReader.Read() +37   System.Data.Common.DataAdapter.FillLoadDataRow(SchemaMapping mapping) +167   System.Data.Common.DataAdapter.FillFromReader(DataSet dataset, DataTable datatable, String srcTable, DataReaderContainer dataReader, Int32 startRecord, Int32 maxRecords, DataColumn parentChapterColumn, Object parentChapterValue) +292   System.Data.Common.DataAdapter.Fill(DataTable[] dataTables, IDataReader dataReader, Int32 startRecord, Int32 maxRecords) +657   System.Data.Common.DbDataAdapter.FillInternal(DataSet dataset, DataTable[] datatables, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +368   System.Data.Common.DbDataAdapter.Fill(DataTable[] dataTables, Int32 startRecord, Int32 maxRecords, IDbCommand command, CommandBehavior behavior) +487   System.Data.Common.DbDataAdapter.Fill(DataTable dataTable) +293   kartrisProductsDataTableAdapters.ProductsTblAdptr.GetTopList(Nullable`1 Limit, Nullable`1 LANG_ID, Nullable`1 StartDate) in C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\root\0100f439\824b7280\App_Code.cmmgadpu.57.vb:3001   ProductsBLL.GetTopListProductsForCache() in C:\inetpub\wwwroot\kartris28002\App_Code\BLL\ProductsBLL.vb:150   KartSettingsManager.RefreshTopListProductsCache() in C:\inetpub\wwwroot\kartris28002\App_Code\SettingsManager.vb:188   KartrisHttpModule.Init(HttpApplication context) in C:\inetpub\wwwroot\kartris28002\App_Code\HttpModule.vb:46   System.Web.HttpApplication.RegisterEventSubscriptionsWithIIS(IntPtr appContext, HttpContext context, MethodInfo[] handlers) +530   System.Web.HttpApplication.InitSpecial(HttpApplicationState state, MethodInfo[] handlers, IntPtr appContext, HttpContext context) +304   System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +404   System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +475[HttpException (0x80004005): Arithmetic overflow error for data type tinyint, value = 427.]   System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +12656404   System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +159   System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +12496021


Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.34237



Any help would be most appreciated.
By Paul - Thu 26 Feb 2015
Which Kartris version are you using? It looks like the issue is something that is set to be a tinyint (max size 255) is being set to more than that. I recall we have changed one or two tinyint values to small int or int over the past few years, so that would seem to be the first place to start if we know which version it is.
By nickdrye - Fri 27 Feb 2015
I have 28002 installed on ISS7.5 (WinSvr2008R2 & SQL2008R2)
I tracked this down to the SP that specified an input variable as a tinyint, I changed the input variable declaration to int and then ran the website again, the problem didn't recur but I wasn't happy the leave it at that. I checked the field data-type that the SP was referencing and it was tinyint, so the problem shouldnt have been fixed by changing variable declaration in the SP.
I changed the SP back to its original state and the problem has not returned.
I did not have the luxury of time and so didn't get the opportunity to track this problem to its root cause therefore I have to expect the problem to recur at some point.What makes things worse is that I'm not even sure which user actions led to the problem.
By Paul - Fri 27 Feb 2015
I think in all likelihood, the change you did fixed the problem, but the sproc is used by a control on the site whose output is cached. Therefore, after the fix, it runs, and the control does what it should, and then gets cached. You revert the sproc, but because the control has cached a good copy, it doesn't re-run the sproc again.

But the cache would eventually expire and the problem would be back. So I would not change the sproc back to the original version, I would keep the change you made which seemed to fix the problem.