ryan = "Select A.*, B.* from training as A, participant as B where B.partname = '" & TextBox1.Text & "' and A.traincode = 'B.traincode'"

                rs1.CursorLocation = ADODB.CursorLocationEnum.adUseClient
                rs1.Open(ryan, cn, ADODB.CursorTypeEnum.adOpenDynamic, ADODB.LockTypeEnum.adLockOptimistic)
                Form11.ListView1.Items.Clear()
                Dim AddItem As ListViewItem
                Do While Not rs1.EOF
                    AddItem = New ListViewItem(rs1.Fields!traincode.Value.ToString)
                    AddItem.SubItems.Add(rs1.B.Fields!title.Value)
                    AddItem.SubItems.Add(rs1.Fields!venue.Value)
                    AddItem.SubItems.Add(rs1.Fields!sdate.Value & "-" & rs1.Fields!edate.Value)
                    Form11.ListView1.Items.Add(AddItem)
                    rs1.MoveNext()
                Loop

there's no error but no data shown in my listview every time i search the correct data. is there a problem on my sql code?

hi ryan, I'm a bit rusty on adodb but I've got a feeling recordset.MoveFirst needs to be called before looping through records. Something like this:

With rs1
            'First check there are records
            If Not (.BOF And .EOF) Then
                .MoveFirst()
                Do While Not .EOF
                    'Add your listview stuff
                    .MoveNext()
                Loop
            End If
        End With
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.