VB.NET tutorial: Command and DataReader Objects
Command and DataReader Objects
You can use the Command object to retrieve data from a database after you connected to it by using the Connection object. The OleDbCommand class is used to construct the Command object. You will supply the SQL selection statement and the Connecton object. The The data will be stored in the DataReader object by executing the ExcecuteReader method of the OleDbCommand class. Here is an example code that uses OleDbCommand and OleDbDataReader to read an Ms. Access database called databasedic.accdb.
If you will get the data from SQLServer by using the Command and DataReader, you simply need to change from OleDbCommand and OleDbDataReader to SqlCommand and SqlDataReader. You also need to change the connection string to connect to the SQLServer. You might want to read this page to learn to connect SQLServer database.
con = New OleDbConnection()
Catch e As Exception