If Txt_Plannr.Text = "" And Txt_Titel.Text <> "" Then Dim Sql As New OleDbCommand("SELECT Plannr, Titel1 From TblPlannenLijst where Titel1 Like " & Chr(34) & "*" & Txt_Titel.Text & "*" & Chr(34) & " And Soort='01 Company_BIK' order by Plannr", dbConnection) Dim connection1 As New OleDbConnection(connectiontring) Dim reader1 As OleDbDataReader = Sql.ExecuteReader() While (reader1.Read()) ' Add items TempStr(0) = reader1.Item(0).ToString() TempStr(1) = reader1.Item(1).ToString() TempNode = New ListViewItem(TempStr) Lst_Blocks.Items.Add(TempNode) End While reader1.Close() Else Dim command As New OleDbCommand("SELECT Plannr, Titel1 FROM TblPlannenLijst where Soort='01 Company_BIK' order by Plannr", dbConnection) Dim connection As New OleDbConnection(connectiontring) Dim reader As OleDbDataReader = command.ExecuteReader() While (reader.Read()) ' Add items TempStr(0) = reader.Item(0).ToString() TempStr(1) = reader.Item(1).ToString() TempNode = New ListViewItem(TempStr) Lst_Blocks.Items.Add(TempNode) End While reader.Close() End If dbConnection.Close()
Else
reader1
Change the Like Query as
Dim Sql As New OleDbCommand("SELECT Plannr, Titel1 From TblPlannenLijst where Titel1 Like '%" & Txt_Titel.Text & "%' And Soort='01 Company_BIK' order by Plannr", dbConnection)
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)