Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

i am using microsoft sql server.

there are a few columns such as userid,password,email,DOB and etc.

i thought i just have to check for userid and password. if it match, the user can login.

is this the right way?

  • 2 weeks later...
Posted

Imports System.Data.SqlClient

Module Module9

   public Function CheckPassword(ByRef UID As String, ByRef Password As String) As Boolean
       Dim myConnection As New SqlConnection()
       Dim myRs As ADODB.Recordset
       myConnection.ConnectionString = "Data Source=localhost;Integrated Security=SSPI;Initial Catalog=DATABASENAME"
       myConnection.Open()
       myRs = New ADODB.Recordset()
       myRs.Open("SELECT UserID,PASSWORD FROM MyTABLE WHERE UserID='" & UID & "' AND PASSWORD='" & Password & "'", myConnection, ADODB.CursorTypeEnum.adOpenKeyset, ADODB.LockTypeEnum.adLockOptimistic)
       If myRs.RecordCount > 0 Then
           CheckPassword = True
       Else
           CheckPassword = False
       End If
       myRs.Close()
       myConnection.Close()
   End Function

End Module

 

Try somthing like this

Code today gone tomorrow!
  • 3 weeks later...

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...