[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Value was either too large or too small for an Int16

Posted on 2009-02-19
7
Medium Priority
?
4,883 Views
Last Modified: 2013-11-27
hi .
i need help solving this error message . We have a vb home made intranet done a few years ago in VB .net 2003 . that intranet was running till today with no issues . No code was changed since we dont have any coder around . I believe this can be related to something else, the website runs in IIS and connects to a sql 2005 database .
It uses framework 1.1.4322.2407 .

the error appears when we are selecint options in a combo box . error below ...

Server Error in '/gescom' Application.
--------------------------------------------------------------------------------

Value was either too large or too small for an Int16.
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.OverflowException: Value was either too large or too small for an Int16.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.  

Stack Trace:


[OverflowException: Value was either too large or too small for an Int16.]
   System.Int16.Parse(String s, NumberStyles style, IFormatProvider provider) +129
   System.Convert.ToInt16(String value) +19
   gescom.Forms.adicionar_fx.RAD_Currency_SelectedIndexChanged(Object o, RadComboBoxSelectedIndexChangedEventArgs e) in C:\gescom\forms\adicionar_fx.ascx.vb:248
   Telerik.WebControls.RadComboBox.x7256c9328041ce80(RadComboBoxSelectedIndexChangedEventArgs xfbf34718e704c6bc) +62
   Telerik.WebControls.RadComboBox.x4c7bbe559e842fc5() +54
   System.Web.UI.Page.RaiseChangedEvents() +115
   System.Web.UI.Page.ProcessRequestMain() +1099

 


--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:1.1.4322.2407; ASP.NET Version:1.1.4322.2407




all help is welcome .. thankz in advance .
0
Comment
Question by:lccviper
  • 4
  • 3
7 Comments
 
LVL 19

Accepted Solution

by:
Barthax earned 1500 total points
ID: 23682840
An int16 holds a value between negative 32768 to positive 32767.   Combo boxes inherently have this limit in Windows for the number of items.  I would expect you are trying to add more than 32767 items to the combo box & that is generating the error.

If this is truly the case, I would reviewing exactly what you are populating the combo box with & seeing if there is a better case for the user interaction.
0
 
LVL 1

Author Comment

by:lccviper
ID: 23683504
well althought i didnt understand quite right what your saying, the number 32767 did ring me a bell .
so, looking at it from a user side .
user logs into the intranet, user goes to a table to update the local currency rate for the day, this changes sometimes during the day, so the user have to update it several times a day . Every site/agency we have does this procedure also .. The data are inserted into a table in SQL , that is currently in row 32772 . does this makes sense to you ?
the error is then displayed when the user goes to another page, selects from a combo box buy or sell, then from another combo box, selects the currenty ( then probably performs somekind of operation that will get the current currency value from sql that was previousily inserted ) .. when he clicks the currency the error is displayed .. can this be because the rates table have 32772 rows on it ?
how can solve this, without messing in .net ?
0
 
LVL 19

Expert Comment

by:Barthax
ID: 23690462
Are you attempting to populate the combo box with more than 32767 rows or are you just referencing row 32772?
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 19

Expert Comment

by:Barthax
ID: 23690474
Attempting to read between the lines, are you displaying all the currency changes from an SQL statement?  If so, you could try adding a TOP xx to the SQL statement to force it to return only, say, 30000 rows.
0
 
LVL 1

Author Comment

by:lccviper
ID: 23691392
ok barthax, your comments are really valuable to me ... seems the issue is really that .. the number of rows in the table . im not a asp coder, but can do a few in sql .
when the user opens the currency type to select, it only appears a list with the currency name followed by the actual rate ( ie: USD 1.333 ) . Theres only about 10 currencies in our system , so the combo box only displays the actual number of currencies witch is 10 , but probably is getting the rate from the rate table so it can appear after the currency name .
the ID of the table is using identity, and is defined has integer .
[CurRateId] [int] IDENTITY(1,1) NOT FOR REPLICATION NOT NULL,
What i did to solve this so users can use the platform was issuing the command in sql

DBCC CHECKIDENT
(
      'currates' ,
      reseed, 100
)

dont know if its the correct way to do this, but it worked, users are not able to select the currency from the list without displaying that error . I believe rate ID table started from something like 20000, dunno why it was done like this .
can you please give me some feedback has this was a correct procedure to do . I believe sometime i have to archive this table, since it will fill up in the future again , tryed to change the table ID to bigint, but didnt work well .
guess this is a programming mistake from the company that made the platform, and not actually a error from the system .

thankz in advance
0
 
LVL 1

Author Closing Comment

by:lccviper
ID: 31548817
will accept your solution , since it guided me throught the problem .
thankz .. if you could comment my other post, ill aprecciate it .
many thankz,
mario
0
 
LVL 19

Expert Comment

by:Barthax
ID: 23693979
Thanks for the points.  Unfortunately, I'm coming at the problem from the wrong direction (low-level windows programmer) to know precisely what is going on in the C# framework+SQL interaction - it was just obvious from the stack trace where the resultant problem lay.

I really don't know about the reseeding of the DB either, sorry.  Unfortunately, I'm at the high-end of knowledge there & not the low-level. :(  I expect your reseeding (after having read http://technet.microsoft.com/en-us/library/ms176057.aspx ) will result in a cure for the immediate issue, but may result in adverse effects if you've got none-integrity links in other tables' foreign indexes.  Disclaimer: I may have misunderstood the process of reseeding.
0

Featured Post

NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
It is possible to export the data of a SQL Table in SSMS and generate INSERT statements. It's neatly tucked away in the generate scripts option of a database.
This videos aims to give the viewer a basic demonstration of how a user can query current session information by using the SYS_CONTEXT function
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Suggested Courses

872 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question