You did nothing to help yourself! You haven't even read my past answer (see my comment).
Maciej Los wrote:
Suhail19,
(...)what you need to do is:
1) Create OleDbConnection[^],
2) Open it using method Open()[^] method,
3) Create OleDbCommand[^]
4) Set CommandType[^], CommandText[^] properties,
5) Create OleDbDataReader[^] and call ExecuteReader()[^] method.
6) Create DataTable[^] and Load()[^] data from OleDbDataReader.
7) Bind data with your component to display data(...)
Solution:
Dim oConn As OleDbConnection = Nothing
Dim oComm As OleDbCommand = Nothing
Dim sConn As String = String.Empty
Dim sComm AS String = String.Empty
Dim oRdr As OleDbDataReader = Nothing
Dim oDt As Data.DataTable = Nothing
Try
sConn = "specify connection"
oConn = New OleDbConnection(sConn)
oConn.Open()
sComm = "SELECT * FROM Flats WHERE landlord_ID = " & lstLID.SelectedValue.ToString()
oComm = New OleDbCommand(sComm, oConn)
oRdr = oComm.ExecuteReader()
oDt = New Data.DataTable("TableName")
oDt.Load(ordr)
grdFlats.DataSource=oDt
oConn.Close()
Catch ex As Exception
Finally
End Try
Straight from a head... not tested!