高手现身,帮小弟一个问题!:)谢谢!(今天好像没有高人在,我发了好几次都没人回贴)
我的更新内容包括:Id,Code,Name,Type,Publisher,PurDate,Comment。为什么我的更新不能实现:要不就是没改,要不就是为空。。请专家帮我诊断!谢谢!我的毕业设计其他全部完成了,就差这个更新功能了,急人啊!!拜托各位大侠了,小弟拜谢!
程序如下:
Private Sub dgbook_UpdateCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs) Handles dgbook.UpdateCommand
Dim ds As DataSet = bookInfo.GetBookInfo
Dim Id As Integer
Dim Code As String
Dim Name As String
Dim Type As String
Dim Publisher As String
Dim PurDate As String
Dim Comment As String
'execute the update
Try
Id = CType(e.Item.Cells(0).Text, Integer)
Code = CType(e.Item.Cells(1).Controls(0), TextBox).Text
Name = CType(e.Item.Cells(2).Controls(0), TextBox).Text
Type = CType(e.Item.Cells(3).Controls(0), TextBox).Text
Publisher = CType(e.Item.Cells(4).Controls(0), TextBox).Text
PurDate = CType(e.Item.Cells(5).Controls(0), TextBox).Text
Comment = CType(e.Item.Cells(6).Controls(0), TextBox).Text
updBookInfo.chgbook(Id, Code, Name, Type, Publisher, PurDate, Comment)
Catch ex As SqlException
lbl1.Text = "Sql exception:" & ex.Message
Catch ex As Exception
lbl1.Text = "General exception:" & ex.Message
Finally
dgbook.EditItemIndex = -1
BindGrid(ds)
End Try
End Sub