473,408 Members | 2,813 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,408 software developers and data experts.

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

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

Source Error:


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


Source File: d:\inetpub\wwwroot\WebApplication1\CONTENTCHANGERD EPTIT.aspx.vb Line: 54

Stack Trace:


[FormatException: Input string was not in a correct format.]
System.Number.ParseDouble(String s, NumberStyles style, NumberFormatInfo info) +0
System.Double.Parse(String s, NumberStyles style, IFormatProvider provider) +208
System.Double.Parse(String s) +12
WebApplication1.WebForm25.DataGrid1_UpdateCommand( Object source, DataGridCommandEventArgs e) in d:\inetpub\wwwroot\WebApplication1\CONTENTCHANGERD EPTIT.aspx.vb:54
System.Web.UI.WebControls.DataGrid.OnUpdateCommand (DataGridCommandEventArgs e)
System.Web.UI.WebControls.DataGrid.OnBubbleEvent(O bject source, EventArgs e)
System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args)
System.Web.UI.WebControls.DataGridItem.OnBubbleEve nt(Object source, EventArgs e)
System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args)
System.Web.UI.WebControls.LinkButton.OnCommand(Com mandEventArgs e)
System.Web.UI.WebControls.LinkButton.System.Web.UI .IPostBackEventHandler.RaisePostBackEvent(String eventArgument)
System.Web.UI.Page.RaisePostBackEvent(IPostBackEve ntHandler sourceControl, String eventArgument)
System.Web.UI.Page.RaisePostBackEvent(NameValueCol lection postData)
System.Web.UI.Page.ProcessRequestMain()




--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:1.1.4322.573; ASP.NET Version:1.1.4322.573
Imports System.Data.OleDb
Public Class WebForm25
Inherits System.Web.UI.Page
Dim mycon As OleDbConnection
Dim myadapter As OleDbDataAdapter
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.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()

End Sub
Protected WithEvents Label1 As System.Web.UI.WebControls.Label
Protected WithEvents DataGrid1 As System.Web.UI.WebControls.DataGrid

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

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

#End Region
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
constr = "provider=sqloledb.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 OleDbDataAdapter("select * from itinfo", mycon)
myadapter.Fill(dataset, "itinfo")
DataGrid1.DataSource = dataset.Tables(0)
DataGrid1.DataBind()
End Sub
Private Sub DataGrid1_CancelCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs ) Handles DataGrid1.CancelCommand
DataGrid1.EditItemIndex = -1
bindgrid()
End Sub
Private Sub DataGrid1_UpdateCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs ) Handles DataGrid1.UpdateCommand
Dim temp As String
Dim sertext, stafftext, subtext, context As TextBox
Dim ser As Double

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

ser = Double.Parse(sertext.Text)

stafftext = CType(e.Item.Cells(1).Controls(0), TextBox)
subtext = CType(e.Item.Cells(2).Controls(0), TextBox)
context = CType(e.Item.Cells(3).Controls(0), TextBox)
temp = "update itinfo set name='" & Trim(stafftext.Text) & "',subject='" & Trim(subtext.Text) & "',content='" & Trim(context.Text) & "'where serialno=" & ser
mycmd = New OleDbCommand(temp, mycon)
mycmd.ExecuteNonQuery()
DataGrid1.EditItemIndex = -1
bindgrid()
End Sub
Private Sub DataGrid1_EditCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs ) Handles DataGrid1.EditCommand
DataGrid1.EditItemIndex = e.Item.ItemIndex
bindgrid()
End Sub

Private Sub DataGrid1_DeleteCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs ) Handles DataGrid1.DeleteCommand
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(temp, mycon)
mycmd.ExecuteNonQuery()
DataGrid1.EditItemIndex = -1
bindgrid()
End Sub
End Class
Mar 27 '08 #1
1 4724
r035198x
13,262 8TB
Use \\ instead of \
Mar 27 '08 #2

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

Similar topics

1
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
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...
2
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...
2
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...
3
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/...
1
by: Jack jensen | last post by:
Hello, I have the code below :(simplified zip code format) try { Convert.ToInt32(tbOShipPostalCode.Text); } catch
0
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...
1
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...
1
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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...
0
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...

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.