473,232 Members | 1,647 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,232 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 4712
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...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...

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.