object reference?

Wahtnamas

New member
Joined
Jun 9, 2008
Messages
3
Programming Experience
1-3
Hi I'm trying to search for a date entry in my access database. using the code below. But i keep getting a "Referenced to non-shared member requires an object reference" error. Can someone please tell me what's wrong? :)

VB.NET:
Sub refreshMembers()
        Dim oConn As OleDbConnection
        Dim oComm As OleDbDataAdapter
        Dim sComm As String = "Select MembershipID, Name, DateExpired from tblMembers where DateExpired = " & TextBox1.Text
        Dim oDataSet As New DataSet

        Dim test As String = "My.MySettings.StudentdbConnectionString"
        Try
            oConn = New OleDbConnection(My.MySettings.StudentdbConnectionString)
            oComm = New OleDbDataAdapter(sComm, oConn)

            'Fill the dataset with the results of the query 
            oComm.Fill(oDataSet, "tblMembers")
            'Set the grid source to the dataset and bind the data 
            Me.DataGridView1.DataSource = oDataSet.Tables("tblMembers").DefaultView
        Catch oexpData As OleDb.OleDbException
            MsgBox(oexpData.Message)
            Exit Sub
        End Try
 
Back
Top