Start New Discussion within our Software Development Community

we have problem regarding to the list view portion as you can see on the figure.
On the left list view, we have a list of authors which data bounded through the database.
we want it to transfer several of the information on the right list view then get its primary key from the database.
as of now we have only this piece of code.

    Dim i As Integer

    For i = 0 To lvSelectedAuthor.Items.Count - 1
        sqlstr = "SELECT * FROM author " & _
            "WHERE author.authorno = " & AuthorListBox.SelectedIndex

        sqlcmd = New MySqlCommand(sqlstr, mysqlconn)
        sqldr = sqlcmd.ExecuteReader

        While sqldr.Read
        End While

Catch ex As Exception
End Try

we try to loop it but in return it was only retrieving the same primary key on the database which is the selected index on the left list view.
your answers is very much appreciated.
thanks in advance.

Attachments fasdf.png 22.31 KB

you said left list view is bounded, you should also retrieve the primary keys its like,

SELECT PrimaryKey, AuthorName FROM author

AuthorName column is bounded to leftListView.

'add the Author,

When user select author from the left select the corresponding PrimaryKeys of the selected author.

  Private Sub leftListView_SelectedIndexChanged(sender As System.Object, e As System.EventArgs) Handles leftListView.SelectedIndexChanged
         'Show the primary key by selecting the first index
    End Sub
This article has been dead for over six months. Start a new discussion instead.