Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

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!!!!!!!!!!!!!!!!!!!!! :o :o :o :o

Posted
I don't see where you have GROUPTYPE in the WHERE clause in your query so why have a parameter for it.

 

 

It was ommited when i was testing to see if that was the error but i do have it in the code that is not working

Posted
The fill command fills the data into other column that are invisible on the form. the querry only returns the first parameter value and not the rest also it does not catch the exception when it cant find the data to use to fill

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...