求助--一下午没搞好的datagrid分页绑定问题!大家帮忙看看!
我有这样一段程序:用datagrid 绑定一个表其中左后一列为 添加
If e.CommandName = "add" Then
Dim cpi As Integer = dgclient.CurrentPageIndex '取得当前页索引
Dim i As Integer = e.Item.ItemIndex '取得当前页行数
Dim row As Integer = cpi * 3 + i '总行数
Dim id As Integer = dgclient.Items(row).Cells(0).Text'取得当前选的行的第一列值
Dim str As String = "select count(*) from vclient1 where myid='"& id &"'"
Dim bcom As New SqlCommand(str, myconn1.conn)
当我在第二页点击“添加"出发事件时就出现错误
索引超出范围。必须为非负值并小于集合大小。参数名: index
我在第一页点击“添加“时可以执行没有错误,我在断点调试时,第二页点“添加“后id 怎么为0 到底是哪儿出现了错误?请大家帮忙,谢谢!