datagrid无法编辑更新列值
小弟初学,套用的书上的源代码改成我部门自用,在此部分代码中,更新datagrid中的数据innumstr值,不论怎么更改,该值都保持不变,望高手指教。Sub Grid1_Update(ByVal Sender As Object, ByVal E As DataGridCommandEventArgs)
Dim PaperCodeStr As String = E.Item.Cells(10).Text
Dim InNumStr As String = CType(E.Item.Cells(8).Controls(0), TextBox).Text
Dim CodeStr As String = E.Item.Cells(0).Text
Dim sql As String
If IsNumeric(InNumStr) Then
Cnn = New SqlConnection(ConfigurationSettings.AppSettings("connection"))
Cnn.Open()
sql = "update paperinstoresheet set instorenum=" & CInt(InNumStr) & " where code='" & CodeStr & "' and papercode='" & PaperCodeStr & "'"
cmd = New SqlCommand(sql, Cnn)
cmd.ExecuteNonQuery()
Cnn.Close()
End If
DataGrid1.EditItemIndex = -1
BindGrid()
End Sub