473,811 Members | 2,566 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

System.InvalidC astException: Specified cast is not valid

3 New Member
Server Error in '/Assignment' Application.
--------------------------------------------------------------------------------

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.InvalidC astException: Specified cast is not valid.

Source Error:


Line 94: sqlcom.Paramete rs["@Image"].Value=((TextBo x)e.Item.Cells[2].Controls[0]).Text;
Line 95: sqlcom.Paramete rs["@Name"].Value=((TextBo x)e.Item.Cells[3].Controls[0]).Text;
Line 96: sqlcom.Paramete rs["@Describes "].Value=((TextBo x)e.Item.Cells[4].Controls[0]).Text;
Line 97: sqlcom.Paramete rs["@Money"].Value=((TextBo x)e.Item.Cells[5].Controls[0]).Text;
Line 98: sqlcon.Open();


Source File: c:\inetpub\wwwr oot\assignment1 \rose.ascx.cs Line: 96

Stack Trace:


[InvalidCastExce ption: Specified cast is not valid.]
Assignment.rose .dtgFlower_Upda teCommand(Objec t source, DataGridCommand EventArgs e) in c:\inetpub\wwwr oot\assignment1 \rose.ascx.cs:9 6
System.Web.UI.W ebControls.Data Grid.OnUpdateCo mmand (DataGridComman dEventArgs e) +109
System.Web.UI.W ebControls.Data Grid.OnBubbleEv ent(O bject source, EventArgs e) +507
System.Web.UI.C ontrol.RaiseBub bleEvent(Object source, EventArgs args) +26
System.Web.UI.W ebControls.Data GridItem.OnBubb leEve nt(Object source, EventArgs e) +106
System.Web.UI.C ontrol.RaiseBub bleEvent(Object source, EventArgs args) +26
System.Web.UI.W ebControls.Link Button.OnComman d(Com mandEventArgs e) +121
System.Web.UI.W ebControls.Link Button.System.W eb.UI .IPostBackEvent Handler.RaisePo stBackEvent(Str ing eventArgument) +115
System.Web.UI.P age.RaisePostBa ckEvent(IPostBa ckEve ntHandler sourceControl, String eventArgument) +18
System.Web.UI.P age.RaisePostBa ckEvent(NameVal ueCol lection postData) +138
System.Web.UI.P age.ProcessRequ estMain() +1277




--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:1.1.432 2.573; ASP.NET Version:1.1.432 2.573
Dec 10 '07 #1
2 2506
JamieHowarth0
533 Recognized Expert Contributor
Hi thithi,

Firstly, welcome to TSDN. Please read our FAQ, especially our Posting Guidelines.

Secondly, please do not double-post your question as this clutters up our forum. I have deleted your other post for this purpose.

Thirdly, your question is ASP.NET-specific and has been moved to the .NET Forum (as the ASP forum is for classic ASP with VBScript as per this note which is displayed at the top of the forum).

Hopefully our .NET Experts can help you out on this issue.

Best regards,

medicineworker
Dec 10 '07 #2
Plater
7,872 Recognized Expert Expert
I would say that one of those cells is not actually a TextBox.
Why are you casting down to the control level anyway?
Does
Expand|Select|Wrap|Line Numbers
  1. e.Item.Cells[2].Value.ToString()
  2.  
not work?
Dec 10 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

3
8234
by: karunakar | last post by:
Hi All Here iam getting this Error "Specified cast is not valid." My Project has Onc solution diffrent class libarary In that solution DALfactory solution iam getting this error I was calling this function in DALFactory class library(this library generate the DAL.dll) Another class library has this function public SecurityInfo Login(string username, string password) {
2
2058
by: Michael Moreno | last post by:
Hello, I am failing to understand why I get an invalid cast exception with this very simple code. I have derived the EventArgs class as follow: public class StringArgs : System.EventArgs { public string Msg;
1
828
by: Arjen | last post by:
Hello, Does somebody haves a solution for this? Thanks! Line 74: if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) {
1
1559
by: Miguel Angel Dinelli | last post by:
I´m trying to execute a project and I get this error System.InvalidCastException: Specified cast is not valid. I found in microsoft some Q in 327287, but I not sure how make to solution it. I apreciate your help tks
11
3127
by: Roy Lawson | last post by:
I have no idea what is going on here. I wrote a simple application in VB.NET to generate a Crystal Report, and I am now trying to move it to ASP.NET with Crstal Enterprise. I wish I could tell you how the report works...but I can't even get past connecting to the database :-) I use the typical: Dim oConnection As New SqlConnection(strCon) Dim cmdText As String = "SELECT * FROM viewLogin WHERE " & _
0
1093
by: Miriam | last post by:
Hello, I am trying to edit an xml file. I am using Visual Studio .NET 2003. When I click on the "Data" tab (instead of the XML tab) to enter in data like in excel, the following occurs: If I try to edit/enter data, I get this error: InvalidCastException: Specified cast is not valid I AM able to edit the xml from the xml tab, just not the data tab. A
4
2665
by: DOTNET | last post by:
Hi, Anybody help me regarding this error: I am assigning the values to the session variables when the button is clicked and passing these session variables to the next page and when I am printing these session variables they are printing. After that I am assigning these things in hidden object and in the form submit action I am receiving these hidden values like the following:
0
623
by: QA | last post by:
I am using a Business Scorecard Accelarator in a Sharepoint Portal 2003 using SQL Server 2005 I am getting the following error: Error,5/7/2005 10:50:14 AM,580,AUE1\Administrator,"Specified cast is not valid.","Microsoft.BusinessIntelligence.Scorecard.ScorecardException: Specified cast is not valid. ---> Microsoft.BusinessIntelligence.Scorecard.ScorecardException: Specified cast is not valid. ---> System.InvalidCastException: Specified...
8
4274
by: Gamma | last post by:
I'm trying to inherit subclass from System.Diagnostics.Process, but whenever I cast a "Process" object to it's subclass, I encounter an exception "System.InvalidCastException" ("Specified cast is not valid"). How do I fix it ? using System.Diagnostics; .. .. class NewProcess: Process {
4
1847
by: rsdev | last post by:
Hi, I have an InvalidCastException which is completely puzzling me. I have checked all the members in the stored procedure against my data provider and seems to be ok. Also in the stack trace it says ProcessRequestMain... +3742?? Here's the error; 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...
0
9605
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10651
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10392
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10136
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9208
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7671
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5555
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5693
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3868
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.