I have a vb.net forms program linked to by an oledb connection to a database. The database contains a login table called tbl_user. In the program the user enters their username and password which is compared to the table values
Dim sql As String = "SELECT * FROM tbl_user WHERE username='" & txtUsername.Text & "' AND password = '" & txtPassword.Text & "' "
Dim sqlCom As New System.Data.OleDb.OleDbCommand(sql)
sqlCom.Connection = conn
conn.Open()
Dim sqlRead As System.Data.OleDb.OleDbDataReader = sqlCom.ExecuteReader()
However i also wish to pass through another piece of data on the row it detected, this column is called accesslvl. So i am trying to pass that through then compare it to statements. I cant figure out how to also select and return the accesslvl value.
Things Attempted:
Dim sql As String = "SELECT * FROM tbl_user WHERE username='" & txtUsername.Text & "' AND password = '" & txtPassword.Text & "' "
Dim sqlCom As New System.Data.OleDb.OleDbCommand(sql)
Dim accesslvl As String = "SELECT accesslvl FROM tbl_user WHERE username='" & txtUsername.Text & "' AND password = '" & txtPassword.Text & "' "
Dim accesslvlCom As New System.Data.OleDb.OleDbCommand(accesslvl)
Dim accesslvlInt As Integer
Open Database Connection
sqlCom.Connection = conn
conn.Open()
accesslvlCom = accesslvlInt
variations on the sql string such as
-"SELECT username,password,accesslvl FROM tbl_user WHERE username='" & txtUsername.Text & "' AND password = '" & txtPassword.Text & "' "
The values of accesslvl
are all integers ranging from 0-3.The point of this is so that when accesslvl
is returned it will load the correct ui.