Steps:
1. You created a connection
2. You created a query to be executed
3. You created an adapter using the connection and query.
4. You created a dataset
5. Adapter internally opens up the connection, uses the query, gets the data and imports it into dataset.
6. Adapter closes the connection when done.
For more detail, have a read
here[
^].