roy.vincent.56 0 Newbie Poster

Guys i need help it says there is a data mismatch in criteria expression need help fast!!

Dim statement2 As New OleDbCommand("select * from Student_registration where Student_code = '" & studentnotextbox.Text & "'", conn)

Dim statement2 As New OleDbCommand("select * from Student_registration where Student_code = '" & studentnotextbox.Text & "'", conn)
        statement2.CommandType = CommandType.Text

        Dim adapt4 As New OleDbDataAdapter
        adapt4.SelectCommand = statement2
        adapt4.SelectCommand.ExecuteNonQuery()

        Dim dset As New DataSet
        adapt4.Fill(dset, "Student_registration")



        fnametextbox.Text = dset.Tables("Student_registration").Rows(0).Item("first_name")
        mnametextbox.Text = dset.Tables("Student_registration").Rows(0).Item("middle_name")
        lnametextbox.Text = dset.Tables("Student_registration").Rows(0).Item("last_name")
        addresstextbox.Text = dset.Tables("Student_registration").Rows(0).Item("address")
        statustextbox.Text = dset.Tables("Student_registration").Rows(0).Item("status")
        gendertextbox.Text = dset.Tables("Student_registration").Rows(0).Item("gender")
        contactnotextbox = dset.Tables("Student_registration").Rows(0).Item("contact")
        religiontextbox.Text = dset.Tables("Student_registration").Rows(0).Item("religion")
        monthtextbox.Text = dset.Tables("Student_registration").Rows(0).Item("birthday_month")
        datetextbox.Text = dset.Tables("Student_registration").Rows(0).Item("birthday_day")
        yeartextbox.Text = dset.Tables("Student_registration").Rows(0).Item("birthday_year")
        monametextbox.Text = dset.Tables("Student_registration").Rows(0).Item("mother_name")
        mooccutextbox.Text = dset.Tables("Student_registration").Rows(0).Item("mother_occupation")
        fanametextbox.Text = dset.Tables("Student_registration").Rows(0).Item("father_name")
        faoccutextbox.Text = dset.Tables("Student_registration").Rows(0).Item("father_occupation")




        For i As Integer = 0 To DataGridView1.RowCount - 1
            DataGridView1.Rows(i).DefaultCellStyle.BackColor = Color.Empty

            If studentnotextbox.Text = DataGridView1.Item(0, i).Value Then
                DataGridView1.Rows(i).DefaultCellStyle.BackColor = Color.Aqua

            End If
        Next




    End Sub



    Dim adapt4 As New OleDbDataAdapter
    adapt4.SelectCommand = statement2
    adapt4.SelectCommand.ExecuteNonQuery()

    Dim dset As New DataSet
    adapt4.Fill(dset, "Student_registration")



    fnametextbox.Text = dset.Tables("Student_registration").Rows(0).Item("first_name")
    mnametextbox.Text = dset.Tables("Student_registration").Rows(0).Item("middle_name")
    lnametextbox.Text = dset.Tables("Student_registration").Rows(0).Item("last_name")
    addresstextbox.Text = dset.Tables("Student_registration").Rows(0).Item("address")
    statustextbox.Text = dset.Tables("Student_registration").Rows(0).Item("status")
    gendertextbox.Text = dset.Tables("Student_registration").Rows(0).Item("gender")
    contactnotextbox = dset.Tables("Student_registration").Rows(0).Item("contact")
    religiontextbox.Text = dset.Tables("Student_registration").Rows(0).Item("religion")
    monthtextbox.Text = dset.Tables("Student_registration").Rows(0).Item("birthday_month")
    datetextbox.Text = dset.Tables("Student_registration").Rows(0).Item("birthday_day")
    yeartextbox.Text = dset.Tables("Student_registration").Rows(0).Item("birthday_year")
    monametextbox.Text = dset.Tables("Student_registration").Rows(0).Item("mother_name")
    mooccutextbox.Text = dset.Tables("Student_registration").Rows(0).Item("mother_occupation")
    fanametextbox.Text = dset.Tables("Student_registration").Rows(0).Item("father_name")
    faoccutextbox.Text = dset.Tables("Student_registration").Rows(0).Item("father_occupation")




    For i As Integer = 0 To DataGridView1.RowCount - 1
        DataGridView1.Rows(i).DefaultCellStyle.BackColor = Color.Empty

        If studentnotextbox.Text = DataGridView1.Item(0, i).Value Then
            DataGridView1.Rows(i).DefaultCellStyle.BackColor = Color.Aqua

        End If
    Next




End Sub