C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Communities   Interview   Jobs   Projects   Offshore Development    
Silverlight Tutorials | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Revenue Sharing |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...

New Feature: Community Sites: Create your own .NET community website and start earning from Google AdSense ! It's Free !




Unable to cast object of type cart_provider [] to type 'system.Iconvertible'


Posted Date: 04 Aug 2008      Total Responses: 2

Posted By: priety       Member Level: Bronze     Points: 1


Hello All,

I Am getting an Following Eror:

Unable to cast object of type 'cart_provider[]' to type 'System.IConvertible'. at System.Convert.ToInt32(Object value) at ShoppingCart.createTable() in c:\Inetpub\wwwroot\Ergo\ShoppingCart.aspx.cs:line 64

cart_provider[] session_pid = new cart_provider(Convert.ToInt32(Session["product_id"]); -> This is the line where i am getting an Error

cart_provider is my class where i defined the properties.

Please kindly let me know how to overcome this Erro ASAP.
Thanks in advance




Responses

Author: Nagarajan    04 Aug 2008Member Level: GoldRating:     Points: 4
Try the below, i doubt the problemmight be with "()", replace it with []
because () says a class intialization ,
[] says a array declaration


cart_provider[] session_pid = new cart_provider[Convert.ToInt32(Session["product_id"])];



Author: suren kamana    04 Aug 2008Member Level: SilverRating:     Points: 3
hi
try this code
cart_provider[] session_pid =
new cart_provider[(int32)Session["product_id"]];
I think this will work please tel me whether i was correct or not.




Post Reply
You must Sign In to post a response.
Next : connection problem
Previous : sitemappath
Return to Discussion Forum
Post New Message
Category: ASP.NET

Related Messages



dotNet Slackers   BizTalk Adaptors    Web Design

web conferencing services

Contact Us    Privacy Policy    Terms Of Use