I have a table with 2 field 'Medico' and 'Listino' so I want to select only the fields Listino where there's 'Medico' = Medhi
MEDICO LISTINO
---------------------
Medhi Gheller
Ashi Cadon
Pamdo Gheller
result:
Gheller
Because Medhi has the 'Listino' Gheller
Here's the code
Public DBPath As String = "Listini.accdb"
Public StringaConn As String = "Provider=Microsoft.ACE.OLEDB.12.0; Data Source= " & DBPath & ""
Public DBConn As New OleDbConnection(StringaConn)
Dim Medico As String = "Medhi"
DBConn.Open()
Dim DBCommAssociazione As OleDbCommand = DBConn.CreateCommand
DBCommAssociazione.CommandType = CommandType.Text
DBCommAssociazione.CommandText = "SELECT Listino FROM Associazioni WHERE Medico=Medhi"
Dim reader As OleDbDataReader
reader = DBCommAssociazione.ExecuteReader
While reader.Read()
Me.ListBox1.Items.Add(reader(0))
Me.ListBox1.Items.Add(reader(1))
End While
DBConn.Close()
Thank you.