0

studentrecords table.,.,contains IDNumber,LastName,Course,Firstname

i will login through my system using IDNumber and once i go to the mainform iwant to display LASTname and course to the 2 textboxes in the mainform using the IDNumber as their Primary Key.,.My code errors

  Dim con As New OleDbConnection
        Dim cmd As New OleDbCommand
        Dim da As New OleDbDataAdapter
        Dim dt As New DataTable
        Dim sSQL As String = String.Empty

        'try catch block is used to catch the error

        'get connection string declared in the Module1.vb and assing it to conn variable
        con = New OleDbConnection(Get_Constring)
        con.Open()
        cmd.Connection = con
        cmd.CommandType = CommandType.Text
        sSQL = "SELECT  LastName FROM studentsrecords where IDNumber like '%" & studentslogin.[txtIDNumber].Text & "%' order by ID desc"

        cmd.CommandText = sSQL
        da.SelectCommand = cmd
        da.Fill(dt)



        'evalutionrate.[lbllogin].Text = studentslogin.[txtIDNumber].Text
        evalutionrate.[lbllogin].Text = sSQL
        evalutionrate.Show()
2
Contributors
1
Reply
16
Views
3 Years
Discussion Span
Last Post by ReyJEnriquez
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.