此代码尝试在数据库的列表视图字段中显示,但是当他尝试显示搜索的部分时,他重复以前的数据
Dim ds As DataSet = New DataSet
Dim sqlcon As MySqlConnection
Dim da As MySqlDataAdapter
If sqlcon.State = ConnectionState.Open Then
MsgBox("connected")
da = New MySqlDataAdapter("SELECT cod_funcionario, matricula, nome, cpf, rg, sexo, email, telefone, endereco, data_nasc, setor FROM funcionario", sqlcon)
da.Fill(ds, "funcionario")
Tabelas.Items.Clear()
If ds.Tables("funcionario").Rows.Count > 0 Then
For i As Integer = 0 To ds.Tables("funcionario").Rows.Count - 1
With Tabelas.Items.Add(ds.Tables("funcionario").Rows(i).Item(0).ToString)
.SubItems.Add(ds.Tables("funcionario").Rows(i).Item(1).ToString)
.SubItems.Add(ds.Tables("funcionario").Rows(i).Item(2).ToString)
.SubItems.Add(ds.Tables("funcionario").Rows(i).Item(3).ToString)
.SubItems.Add(ds.Tables("funcionario").Rows(i).Item(4).ToString)
.SubItems.Add(ds.Tables("funcionario").Rows(i).Item(5).ToString)
.SubItems.Add(ds.Tables("funcionario").Rows(i).Item(6).ToString)
.SubItems.Add(ds.Tables("funcionario").Rows(i).Item(7).ToString)
.SubItems.Add(ds.Tables("funcionario").Rows(i).Item(8).ToString)
.SubItems.Add(ds.Tables("funcionario").Rows(i).Item(9).ToString)
.SubItems.Add(ds.Tables("funcionario").Rows(i).Item(10).ToString)
End With
Next
End If
Else