Hi Guys,
I got a slight problem that could be very funny but i need help and fast. I am trying to create a logon page that takes the logon credential from a database but once i am using the multiple parameters the code does not check the parameters and just logs on even with wrong details.......
This is the code for select statement
Me.OleDbSelectCommand1.CommandText = "SELECT USERNAME, PASSWORD, GROUPTYPE FROM DBUSERS WHERE (PASS" & _
"WORD = ?) AND (USERNAME = ?)"
Me.OleDbSelectCommand1.Parameters.Add(New System.Data.OleDb.OleDbParameter("USERNAME", System.Data.OleDb.OleDbType.VarChar, 20, "USERNAME"))
Me.OleDbSelectCommand1.Parameters.Add(New System.Data.OleDb.OleDbParameter("PASSWORD", System.Data.OleDb.OleDbType.VarChar, 20, "PASSWORD"))
Me.OleDbSelectCommand1.Parameters.Add(New System.Data.OleDb.OleDbParameter("GROUPTYPE", System.Data.OleDb.OleDbType.VarChar, 20, "GROUPTYPE"))
This is the text retrieval and fill code
OleDbDataAdapter1.SelectCommand.Parameters("USERNAME").Value = txtusername.Text
OleDbDataAdapter1.SelectCommand.Parameters("PASSWORD").Value = txtPwd.Text
OleDbDataAdapter1.SelectCommand.Parameters("GROUPTYPE").Value = gptype.Text
Login21.Clear()
Try
OleDbDataAdapter1.Fill(Login21)
Catch ex As Exception
MessageBox.Show("Logon Failed", "Logon Error")
End Try
what am i doing wrong? i have to present this application at Uni tomorrow help!!!!!!!!!!!!!!!!!!!!!
I got a slight problem that could be very funny but i need help and fast. I am trying to create a logon page that takes the logon credential from a database but once i am using the multiple parameters the code does not check the parameters and just logs on even with wrong details.......
This is the code for select statement
Me.OleDbSelectCommand1.CommandText = "SELECT USERNAME, PASSWORD, GROUPTYPE FROM DBUSERS WHERE (PASS" & _
"WORD = ?) AND (USERNAME = ?)"
Me.OleDbSelectCommand1.Parameters.Add(New System.Data.OleDb.OleDbParameter("USERNAME", System.Data.OleDb.OleDbType.VarChar, 20, "USERNAME"))
Me.OleDbSelectCommand1.Parameters.Add(New System.Data.OleDb.OleDbParameter("PASSWORD", System.Data.OleDb.OleDbType.VarChar, 20, "PASSWORD"))
Me.OleDbSelectCommand1.Parameters.Add(New System.Data.OleDb.OleDbParameter("GROUPTYPE", System.Data.OleDb.OleDbType.VarChar, 20, "GROUPTYPE"))
This is the text retrieval and fill code
OleDbDataAdapter1.SelectCommand.Parameters("USERNAME").Value = txtusername.Text
OleDbDataAdapter1.SelectCommand.Parameters("PASSWORD").Value = txtPwd.Text
OleDbDataAdapter1.SelectCommand.Parameters("GROUPTYPE").Value = gptype.Text
Login21.Clear()
Try
OleDbDataAdapter1.Fill(Login21)
Catch ex As Exception
MessageBox.Show("Logon Failed", "Logon Error")
End Try
what am i doing wrong? i have to present this application at Uni tomorrow help!!!!!!!!!!!!!!!!!!!!!