Advertisement

01.02.2008 at 12:47PM PST, ID: 23054112
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

Specified cast is not valid.  -how do I determine which variable is invalid?

Tags: ASP.NET VB.NET, Specified cast is not valid.
I have a function in which variables are passed to it that is generating a "Specified cast is not valid"
However, I have no clue as to determine WHICH variable is incorrectly cast in the function (where the program halts).  The error message seems to indicate that it is related somehow to an SQL query, although no SQL queries are being made prior to or in the function.
Is there any possible way to figure out what variable is the culprit without guessing?
Tracing shows that all the function's input values are perfectly correct and formed with values.

Attached is the error message.  I just need to know where to begin as I've been struggling with this for hours now with no luck using trial-and-error.
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
Specified cast is not valid.
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.InvalidCastException: Specified cast is not valid.
 
Source Error:
 
Line 239:					End If
Line 240:				Else
Line 241:					cart.AddItem(ThisCustomer, ShippingAddressID, ProductID, VariantID, Quantity, ChosenColor, ChosenColorSKUModifier, ChosenSize, ChosenSizeSKUModifier, TextOption, CartType, False, False, 0, CustomerEnteredPrice)
Line 242:				End If
Line 243:			End If
 
 
Source File: E:\SITES\SmokeWagonGear\Web\addtocart.aspx.vb    Line: 241
 
Stack Trace:
 
[InvalidCastException: Specified cast is not valid.]
   System.Data.SqlClient.SqlBuffer.get_Int32() +985292
   System.Data.SqlClient.SqlDataReader.GetInt32(Int32 i) +39
   AspDotNetStorefrontCommon.DB.RSFieldInt(IDataReader rs, String fieldname) +137
   AspDotNetStorefrontCommon.AppLogic.DetermineLevelPrice(Int32 VariantID, Int32 CustomerLevelID) +244
   AspDotNetStorefrontCommon.ShoppingCart.AddItem(Customer ThisCustomer, Int32 ShippingAddressID, Int32 ProductID, Int32 VariantID, Int32 Quantity, String ChosenColor, String ChosenColorSKUModifier, String ChosenSize, String ChosenSizeSKUModifier, String TextOption, CartTypeEnum CartType, Boolean UpdateCartObject, Boolean IsRequired, Int32 GiftRegistryForCustomerID, Decimal CustomerEnteredPrice) +2951
   AspDotNetStorefront.addtocart.Page_Load(Object sender, EventArgs e) in E:\SITES\SmokeWagonGear\Web\addtocart.aspx.vb:241
   System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +15
   System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +33
   System.Web.UI.Control.OnLoad(EventArgs e) +99
   System.Web.UI.Control.LoadRecursive() +47
   System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1436
Start your free trial to view this solution
Question Stats
Zone: Programming
Question Asked By: bd9000
Solution Provided By: bd9000
Participating Experts: 3
Solution Grade: B
Views: 33
Translate:
Loading Advertisement...
01.02.2008 at 01:02PM PST, ID: 20567945

Rank: Genius

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
01.02.2008 at 01:14PM PST, ID: 20568051

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
01.02.2008 at 01:19PM PST, ID: 20568095

Rank: Genius

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
01.02.2008 at 01:21PM PST, ID: 20568126

Rank: Guru

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
01.03.2008 at 06:56PM PST, ID: 20579530

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
01.03.2008 at 07:43PM PST, ID: 20579820

Rank: Genius

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
01.04.2008 at 06:20AM PST, ID: 20582273

Rank: Guru

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
Loading Advertisement...
20080236-EE-VQP-29 / EE_QW_2_20070628