本文介绍了像查询处理但没有添加到listview的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 可以任何一个请求指南下面的错误是我的代码 如果 Txt_Plannr.Text = 并且 Txt_Titel.Text<> 然后 Dim Sql As 新 OleDbCommand( SELECT Plannr,Titel1来自TblPlannenLijst,其中Titel1喜欢& Chr( 34 )& *& Txt_Titel.Text& *& Chr( 34 )& Soort = '01 Company_BIK'由Plannr命令,dbConnection) Dim connection1 As 新 OleDbConnection(connectiontring) Dim reader1 As OleDbDataReader = Sql.ExecuteReader() While (reader1.Read()) ' 添加项目 TempStr( 0 )= reader1.Item( 0 )。ToString() TempStr( 1 )= reader1.Item( 1 )。ToString() TempNode = 新 ListViewItem(TempStr) Lst_Blocks.Items.Add(TempNode) 结束 while reader1.Close() Else Dim 命令 As 新 OleDbCommand( SELECT Plannr,Titel1 FROM TblPlannenLijst where Soort = '01 Company_BIK'由Plannr命令,dbConnection) Dim connection As 新 OleDbConnection(连接字符串) Dim reader As OleDbDataReader = command.ExecuteReader() while (reader.Read()) ' 添加项目 TempStr( 0 )= reader.Item( 0 )。ToString() TempStr( 1 )= reader.Item( 1 )。ToString() TempNode = 新 ListViewItem(TempStr) Lst_Blocks.Items.Add(TempNode) 结束 while reader.Close() 结束 如果 dbConnection.Close() Else 部分工作但条件不起作用 Access数据库查询正在运行,但没有项目添加到列表视图 请指南解决方案 将类似查询更改为 Dim Sql As New OleDbCommand( SELECT Plannr,Titel1来自TblPlannenLijst,其中Titel1喜欢'%'& Txt_Titel.Text& %'和Soort = '01 Company_BIK'由Plannr命令,dbConnection) Can Any one plese Guide what is the error below is my codeIf 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 part is working but the condition is not working Access database Query is running but no items added to the list viewPlease Guide 解决方案 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) 这篇关于像查询处理但没有添加到listview的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 11-02 03:28