473,732 Members | 2,201 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Exception Details: System.FormatEx ception: Input string was not in a correct format.

1 New Member
THIS IS AN ASP.NET 1.1 APPLICATION IAM TRYING TO UPDATE THE FIELD BUT I AM NOT ABLE TO UPDATE IT?
CAN U TELL THE REASON ?
IT IS GIVING THE FOLLOWING ERROR
BELOW I HAVE ALSO GIVEN THE CODE OF THE PROGRAM
PLEASE HELP ME
Server Error in '/WebApplication1 ' Application.
--------------------------------------------------------------------------------

Input string was not in a correct format.
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.FormatEx ception: Input string was not in a correct format.

Source Error:


Line 52: sertext = CType(e.Item.Ce lls(0).Controls (0), TextBox)
Line 53:
Line 54: ser = Double.Parse(se rtext.Text)
Line 55:
Line 56: stafftext = CType(e.Item.Ce lls(1).Controls (0), TextBox)


Source File: d:\inetpub\wwwr oot\WebApplicat ion1\CONTENTCHA NGERDEPTIT.aspx .vb Line: 54

Stack Trace:


[FormatException : Input string was not in a correct format.]
System.Number.P arseDouble(Stri ng s, NumberStyles style, NumberFormatInf o info) +0
System.Double.P arse(String s, NumberStyles style, IFormatProvider provider) +208
System.Double.P arse(String s) +12
WebApplication1 .WebForm25.Data Grid1_UpdateCom mand(Object source, DataGridCommand EventArgs e) in d:\inetpub\wwwr oot\WebApplicat ion1\CONTENTCHA NGERDEPTIT.aspx .vb:54
System.Web.UI.W ebControls.Data Grid.OnUpdateCo mmand(DataGridC ommandEventArgs e)
System.Web.UI.W ebControls.Data Grid.OnBubbleEv ent(Object source, EventArgs e)
System.Web.UI.C ontrol.RaiseBub bleEvent(Object source, EventArgs args)
System.Web.UI.W ebControls.Data GridItem.OnBubb leEvent(Object source, EventArgs e)
System.Web.UI.C ontrol.RaiseBub bleEvent(Object source, EventArgs args)
System.Web.UI.W ebControls.Link Button.OnComman d(CommandEventA rgs e)
System.Web.UI.W ebControls.Link Button.System.W eb.UI.IPostBack EventHandler.Ra isePostBackEven t(String eventArgument)
System.Web.UI.P age.RaisePostBa ckEvent(IPostBa ckEventHandler sourceControl, String eventArgument)
System.Web.UI.P age.RaisePostBa ckEvent(NameVal ueCollection postData)
System.Web.UI.P age.ProcessRequ estMain()




--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:1.1.432 2.573; ASP.NET Version:1.1.432 2.573
Imports System.Data.Ole Db
Public Class WebForm25
Inherits System.Web.UI.P age
Dim mycon As OleDbConnection
Dim myadapter As OleDbDataAdapte r
Dim dataset As New DataSet
Dim constr As String
Dim mycmd As OleDbCommand
#Region " Web Form Designer Generated Code "

'This call is required by the Web Form Designer.
<System.Diagnos tics.DebuggerSt epThrough()> Private Sub InitializeCompo nent()

End Sub
Protected WithEvents Label1 As System.Web.UI.W ebControls.Labe l
Protected WithEvents DataGrid1 As System.Web.UI.W ebControls.Data Grid

'NOTE: The following placeholder declaration is required by the Web Form Designer.
'Do not delete or move it.
Private designerPlaceho lderDeclaration As System.Object

Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArg s) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeCompo nent()
End Sub

#End Region
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArg s) Handles MyBase.Load
constr = "provider=sqlol edb.1;user id=sa;initial catalog=master"
mycon = New OleDbConnection (constr)
mycon.Open()
If Not IsPostBack Then
bindgrid()
End If
End Sub
Sub bindgrid()
myadapter = New OleDbDataAdapte r("select * from itinfo", mycon)
myadapter.Fill( dataset, "itinfo")
DataGrid1.DataS ource = dataset.Tables( 0)
DataGrid1.DataB ind()
End Sub
Private Sub DataGrid1_Cance lCommand(ByVal source As Object, ByVal e As System.Web.UI.W ebControls.Data GridCommandEven tArgs) Handles DataGrid1.Cance lCommand
DataGrid1.EditI temIndex = -1
bindgrid()
End Sub
Private Sub DataGrid1_Updat eCommand(ByVal source As Object, ByVal e As System.Web.UI.W ebControls.Data GridCommandEven tArgs) Handles DataGrid1.Updat eCommand
Dim temp As String
Dim sertext, stafftext, subtext, context As TextBox
Dim ser As Double

sertext = CType(e.Item.Ce lls(0).Controls (0), TextBox)

ser = Double.Parse(se rtext.Text)

stafftext = CType(e.Item.Ce lls(1).Controls (0), TextBox)
subtext = CType(e.Item.Ce lls(2).Controls (0), TextBox)
context = CType(e.Item.Ce lls(3).Controls (0), TextBox)
temp = "update itinfo set name='" & Trim(stafftext. Text) & "',subject= '" & Trim(subtext.Te xt) & "',content= '" & Trim(context.Te xt) & "'where serialno=" & ser
mycmd = New OleDbCommand(te mp, mycon)
mycmd.ExecuteNo nQuery()
DataGrid1.EditI temIndex = -1
bindgrid()
End Sub
Private Sub DataGrid1_EditC ommand(ByVal source As Object, ByVal e As System.Web.UI.W ebControls.Data GridCommandEven tArgs) Handles DataGrid1.EditC ommand
DataGrid1.EditI temIndex = e.Item.ItemInde x
bindgrid()
End Sub

Private Sub DataGrid1_Delet eCommand(ByVal source As Object, ByVal e As System.Web.UI.W ebControls.Data GridCommandEven tArgs) Handles DataGrid1.Delet eCommand
Dim temp As String
Dim ser As Integer
Dim sertxt As TextBox
ser = e.Item.Cells(0) .Text
temp = "delete itinfo where serialno=" & ser
Response.Write( temp)
mycmd = New OleDbCommand(te mp, mycon)
mycmd.ExecuteNo nQuery()
DataGrid1.EditI temIndex = -1
bindgrid()
End Sub
End Class
Mar 27 '08 #1
1 4763
r035198x
13,262 MVP
Use \\ instead of \
Mar 27 '08 #2

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

Similar topics

1
7787
by: .YC | last post by:
Hi, I was trying on the following code n I got an exception. Can anyone tell me whats wrong? using System; namespace Module_2 { /// <summary>
3
1368
by: CSharpX | last post by:
I have the following code and when the exception is raised the OS displays a nasty Stop dialog box it says an unhandled exception occured, gives 3 buttons to click details, contintue Quit... i do not want this ugly thing to display, what am i missing from the code below? am i not catching that exception and displaying my own error message? so why is the other one coming up after mine public bool isInteger(string str int i=0 bool...
2
11150
by: Newbie | last post by:
Im getting an exception: System.FormatException: Input string was not in a correct format. at System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info) at System.String.System.IConvertible.ToInt32(IFormatProvider provider) at System.Convert.ToInt32(Object value) at System.Data.Common.Int32Storage.Set(Int32 record, Object value) at System.Data.DataColumn.set_Item(Int32 record, Object value)Couldn't store <BILLABLE...
2
11118
by: sbox | last post by:
I've got an error "System.FormatException: Input string was not in a correct format." while I'm implementing a datagrid and a textbox What's wrong with it? Sub Button1_Click(sender As Object, e As EventArgs) DataGrid1.DataSource = MyQueryMethod(CInt(TextBox1.Text)) DataGrid1.DataBind() End Sub Function MyQueryMethod(ByVal others As String) As System.Data.DataSet
3
11747
by: dan | last post by:
I am using VB.NET 2003 and SQL Server 2000. The program uses ADO.NET . The following instruction: Me.cd_insertDataRecord.ExecuteNonQuery() throws this exception: ">>>ProcessDataRecord/ Exception: Type= System.FormatException Message: Input string was not in a correct format. StackTrace: at System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream)
1
1237
by: Jack jensen | last post by:
Hello, I have the code below :(simplified zip code format) try { Convert.ToInt32(tbOShipPostalCode.Text); } catch
0
3125
by: bnlockwood | last post by:
G'day all, Thank you in advance for anyone that can help. I have a shopping cart datagrid on my c# asp.net page. This is the code: ------------------------------------- <asp:datagrid id="grdShoppingCart" OnItemDataBound="ItemDB"
1
5166
by: Ratz | last post by:
Hello everyone! I'm new to this Forum! I've spent about 56 hours trying to solve a .NET VB Runtime error while Using a program.Ive contacted the developer of the program and he could not figure out why i'm getting these errors! SO i have come here for the Help from the GURUS! here is one message that pops up! See the end of this message for details on invoking just-in-time (JIT) debugging instead of this dialog box. **************...
1
10696
by: Remi THOMAS | last post by:
Hi, When you execute this line of code string script = string.Format("foreach (GroupDoc gdoc in {0}.SetGroup(\"{1}\") {\r\n", "p1", "p2"); You get System.FormatException was unhandled Message="Input string was not in a correct format." Source="mscorlib"
0
8946
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8774
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
9307
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
9181
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
8186
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
6735
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
6031
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
3261
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2721
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.