i'm very much new to this, i have the following code:
This works but all I need to know is what to change, probably on this line
So I can get a list of the data in just a particular column and not all the data...?
it's probably something very simple..any ideas???...
VB.NET:
Dim connetionString As String
Dim oledbCnn As OleDbConnection
Dim oledbCmd As OleDbCommand
Dim sql As String
connetionString = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=H:\My Pictures\hotel_db.mdb;User Id=admin;Password=;"
sql = "Select * from tbl_calendar"
oledbCnn = New OleDbConnection(connetionString)
Try
oledbCnn.Open()
oledbCmd = New OleDbCommand(sql, oledbCnn)
Dim oledbReader As OleDbDataReader = oledbCmd.ExecuteReader()
Do While oledbReader.Read
ListBox1.Items.Add(oledbReader(0))
ListBox1.Items.Add(oledbReader(1))
ListBox1.Items.Add(oledbReader(2))
Loop
oledbReader.Close()
oledbCmd.Dispose()
oledbCnn.Close()
Catch ex As Exception
MsgBox("Can not open connection ! ")
End Try
This works but all I need to know is what to change, probably on this line
VB.NET:
ListBox1.Items.Add(oledbReader(0))
So I can get a list of the data in just a particular column and not all the data...?
it's probably something very simple..any ideas???...