代码: Dim strid, strsql As String
        strid = dg.DataKeys.Item(e.Item.ItemIndex)
        strsql = "delete from student where studentid='" & strid & "'"
        Dim sqlcon As New SqlClient.SqlConnection("server=zhao2310;database=zhao;user id=sa;password=")
        sqlcon.Open()
        Dim sqlcommand As New SqlClient.SqlCommand
        sqlcommand.Connection = sqlcon
        sqlcommand.CommandText = strsql
        sqlcommand.ExecuteNonQuery()
        sqlcon.Close()
        sqlcon = Nothing
        dg.EditItemIndex = -1
        bindgrid()
错误:
异常详细信息: System.ArgumentOutOfRangeException: 索引超出范围。必须为非负值并小于集合大小。参数名: index
strid = dg.DataKeys.Item(e.Item.ItemIndex)提示该行有问题!!!