CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: Security.bas

  1. #1
    Join Date
    Jan 1999
    Posts
    1

    Security.bas



    I am using VB5 to learn VB with. I an going through exercises in a beginners book and have come to a stumbling block. The book refers to using a procedure in s file caled Security.bas. I searched for this file, but I did not find the file anywhere. I called a friend for help, but he did not have a clue either. Can someone help me with this or possibly send me a copy of the file? I am just learning and not sure what to do right now. Thanks ...mike...

  2. #2
    Join Date
    Nov 1999
    Location
    Maryland - USA
    Posts
    11

    Re: Security.bas

    Hi Michael!
    I'm learning VB6. One of my previous assigment had security.bas file. I faced with the same problem like you did, noone was able to help me find the solution to that, so finally I didn't use security.bas.
    I guest security.bas works for VB5????

    I have an example of security.bas from that assignment ( My assignment was to create a logon form using this file). Hopefully this code will give you some idea of how security.bas look like. Tell me if this help solve your problem ok? Heru
    ------------------------------------------------------------------------------------------------------------------------------------------

    Option Explicit

    'declare DAO variables
    Private db As Database
    Private rs As Recordset

    Public Function GoodCredentials(UserName As String, Password As String) As Boolean
    'This function is exposed to the project and is used to check _
    the user name and password passed from the Logon form. If the _
    user name and password are found, the function returns True.

    'Use DAO to create a recordset object to search.
    Set db = OpenDatabase("\Data\Security.mdb")
    Set rs = db.OpenRecordset("tblUsers", dbOpenDynaset)

    'Search the recordset object for the user name.
    rs.FindFirst "[UserName] = '" & UserName & "'"

    'If the user name is found and the password for that record _
    matches the password given by the user, the credentials are _
    good; if no user name is found or if the password is not _
    correct, the credentials are bad.
    If Not rs.NoMatch And rs![Password] = Password Then
    GoodCredentials = True
    Else
    GoodCredentials = False
    End If
    End Function



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured