View Single Post
Join Date: Sep 2007
Posts: 1,080
Reputation: SheSaidImaPregy is an unknown quantity at this point 
Solved Threads: 68
SheSaidImaPregy SheSaidImaPregy is offline Offline
Veteran Poster

Re: Help me in username and password validation through accessing the database

 
0
  #4
Oct 27th, 2007
Try not to use a datasource. You only use datasources, or should anyway, when binding it to a certain repeater/grid/datalist. What I would recommend is using a scalar for this unlessif you are retrieving information as well, then use the reader. Do something like:

Dim strPass As String
Dim conLogin = New OleDBConnection( connection stuff)
Dim cmdSelect = New OleDBCommand( "SELECT PASSWORD FROM PID WHERE PID=@PID", conLogin )
cmdSelect.Parameters.AddWithValue( "@PID", strUserName )
conLogin.Open()
strPass= cmdSelect.ExecuteScalar()
conLogin.Close()
if (String.Compare(strPass, strPassword, False)) = 0 then
'False means that you are comparing case-sensitive. True means case-insensitive
'do user stuff here as zero means it passed validation
else
'do bad stuff here as anything BUT zero means it failed validation
end if
Last edited by SheSaidImaPregy; Oct 27th, 2007 at 11:12 pm.
Reply With Quote