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