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