Imports System.Data
Imports System.Data.OleDb

Public Class Form1
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

        Dim conDB As New OleDb.OleDbConnection    'this defines the connection to the database
        conDB.ConnectionString = "Provider=SQLNCLI10;Server=cypress.csil.sfu.ca;Database=aworks;Uid=sa;Pwd=mypasswrd"
        'conDB.ConnectionString = "DO THE ACTUAL CONNECTION STRING"
        'the connection string for SQL Server has this format: 
        'Provider=SQLNCLI10;Server=myServerAddress;Database=myDataBase;Uid=myUsername; Pwd=myPassword;

        Dim comDB As New OleDb.OleDbCommand       'represents a database command
        Dim dbrDB As OleDbDataReader                'is a data reader used to store the result of the database query
        Dim SQLQuery As String

        conDB.Open()
        comDB.Connection = conDB                    'tell what connection to use for the database command

        SQLQuery = "SELECT intUserID, intAccess FROM Users WHERE binActive = 1"     'put together query
        comDB.CommandText = SQLQuery        'assign the query to a database command
        dbrDB = comDB.ExecuteReader()       'execute query into reader

        While dbrDB.Read        'cycle through resulting tuples
            labelname.Text = "MESSAGE" & dbrDB("intUserID") ' do something with message
        End While
    End Sub
End Class