Please take the time to read over the following 2 quick articles on how to use a database in your program:
There are a couple of different controls that you can use to retrieve the data from the database. One of these controls is the
OleDbReader...which is returned by the
OleDbCommand.ExecuteReader method.
Here's an example (taken from MSDN):
-
-
Public Sub ReadMyData(myConnString As String)
-
Dim mySelectQuery As String = "SELECT OrderID, CustomerID FROM Orders"
-
Dim myConnection As New OleDbConnection(myConnString)
-
Dim myCommand As New OleDbCommand(mySelectQuery, myConnection)
-
myConnection.Open()
-
Dim myReader As OleDbDataReader
-
myReader = myCommand.ExecuteReader()
-
' Always call Read before accessing data.
-
While myReader.Read()
-
Console.WriteLine(myReader.GetInt32(0).ToString() + ", " _
-
+ myReader.GetString(1))
-
End While
-
' always call Close when done reading.
-
myReader.Close()
-
' Close the connection when done with it.
-
myConnection.Close()
-
End Sub
If you don't like this solution, you could always use the
OleDataAdapter to fill a DataSet instead.
-Frinny