G
Guest
I have a numeric column in Oracle which is populated using a .NET Datagrid.
The problem is whenever i try to fill it with empty value when the user
clears the value that is filled already, I get an error. Iam pasting chunks
of code :
Private Sub DataGrid1_UpdateCommand(ByVal source As Object, ByVal e As
System.Web.UI.WebControls.DataGridCommandEventArgs) Handles
DataGrid1.UpdateCommand
Dim key As String = DataGrid1.DataKeys(e.Item.ItemIndex).ToString
Dim intStepID, strCheckList_Name, strSQL, strResource, strStatus,
strGraceDate, strMan, strAnswer, strOrder, strAuditRemarks, strURL
Dim strLBound, strHBound As Int32
Dim tBox As TextBox
Dim r As dsChkListModify.CHECKLIST_INSTRow
r = DsChkListModify1.CHECKLIST_INST.FindByCI_ID(key)
tBox = CType(e.Item.Cells(7).Controls(0), TextBox)
strHBound = tBox.Text
r.CI_LBOUND = strLBound
finally I do a TRY & CATCH to update the db:
Try
OleDbDataAdapter1.Update(DsChkListModify1)
DataGrid1.DataBind()
Label1.ForeColor = Color.Green
Label1.Text = "Update was successfull!"
Catch ex As Exception
If Len(ex.ToString()) > 0 Then
Label1.ForeColor = Color.Red
Label1.Text = ex.Message '"An Error occured. Please enter a
valid value!"
End If
Finally
End Try
DataGrid1.EditItemIndex = -1
DataGrid1.DataBind()
End Sub
Thanks in adv.
RajSB
The problem is whenever i try to fill it with empty value when the user
clears the value that is filled already, I get an error. Iam pasting chunks
of code :
Private Sub DataGrid1_UpdateCommand(ByVal source As Object, ByVal e As
System.Web.UI.WebControls.DataGridCommandEventArgs) Handles
DataGrid1.UpdateCommand
Dim key As String = DataGrid1.DataKeys(e.Item.ItemIndex).ToString
Dim intStepID, strCheckList_Name, strSQL, strResource, strStatus,
strGraceDate, strMan, strAnswer, strOrder, strAuditRemarks, strURL
Dim strLBound, strHBound As Int32
Dim tBox As TextBox
Dim r As dsChkListModify.CHECKLIST_INSTRow
r = DsChkListModify1.CHECKLIST_INST.FindByCI_ID(key)
tBox = CType(e.Item.Cells(7).Controls(0), TextBox)
strHBound = tBox.Text
r.CI_LBOUND = strLBound
finally I do a TRY & CATCH to update the db:
Try
OleDbDataAdapter1.Update(DsChkListModify1)
DataGrid1.DataBind()
Label1.ForeColor = Color.Green
Label1.Text = "Update was successfull!"
Catch ex As Exception
If Len(ex.ToString()) > 0 Then
Label1.ForeColor = Color.Red
Label1.Text = ex.Message '"An Error occured. Please enter a
valid value!"
End If
Finally
End Try
DataGrid1.EditItemIndex = -1
DataGrid1.DataBind()
End Sub
Thanks in adv.
RajSB