Results 1 to 11 of 11

Thread: [2008] Coding Help

Hybrid View

  1. #1

    Thread Starter
    New Member
    Join Date
    Feb 2008
    Posts
    4

    Re: [2008] Coding Help

    CodeDOM you say? Thanks.

  2. #2
    Lively Member Colin Dias's Avatar
    Join Date
    Jan 2008
    Posts
    99

    Re: [2008] Coding Help

    Hey Ive written code for this although its not exactly how you described it.

    My method looks through a database for user name and passwords and then authenticates the user so that he can access other forms


    Heres the code
    Code:
    Dim con As New OleDb.OleDbConnection
            con.ConnectionString = "PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source = d:\AddressBook.mdb"
            Dim sql As String
            Dim ds As New DataSet
            Dim userID As String
            Dim da As New OleDb.OleDbDataAdapter
            Dim password As String
            Dim int1 As Integer
            Dim maxrows As Integer
    
            userID = UsernameText.Text
            password = PasswordText.Text
    
            con.Open()
            int1 = 0
            sql = "SELECT * FROM login"
            da = New OleDb.OleDbDataAdapter(sql, con)
            da.Fill(ds, "AddressBook")
            maxrows = ds.Tables("AddressBook").Rows.Count
    
            Do Until int1 = 4
                If ds.Tables("AddressBook").Rows(int1).Item(0) = userID And ds.Tables("AddressBook").Rows(int1).Item(1) = password Then
                    Form1.Show()
                    Me.Hide()
                    Exit Sub
                Else
                End If
                int1 = int1 + 1
            Loop
    
            Dim msg As String
            msg = MsgBox("Username/password mismatch!", vbOKCancel)
            If msg = 1 Then
                Me.Show()
                UsernameText.Text = ""
                PasswordText.Text = ""
                UsernameText.Focus()
    
            Else
                Me.Close()
            End If
        End Sub
    .

    Hope this helps!

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