高手救命啊!!!
这个函数是获取数据填充到listbox的代码,当从数据库删除一个数据后,Dim dr As DataRow = dt.Rows(0)就出错了,显示0处没有任何行 Private Sub getUser(ByVal id As String)
Dim sql As String = "select * from [user] where UserId='" & id.Trim() & "'"
Dim dt As DataTable = sample.GetDataTable(sql)
Dim dr As DataRow = dt.Rows(0)
If dt.Rows.Count <> 0 Then
Me.tbId.Text = dr("UserId").ToString().Trim()
Me.tbName.Text = dr("Username").ToString().Trim()
Me.setcheck(dr("purview").ToString().Trim())
Try
Catch ex As Exception
sample.WriteErr(ex)
End Try
End If
End Sub