Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Visual Basic > VB 2005 > Visual Basic 2005 Basics
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Visual Basic 2005 Basics If you are new to Visual Basic programming with version 2005, this is the place to start your questions. For questions about the book: Beginning Visual Basic 2005 by Thearon Willis and Bryan Newsome, ISBN: 0-7645-7401-9 please, use this forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Visual Basic 2005 Basics section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old July 31st, 2008, 11:49 PM
Registered User
 
Join Date: Jul 2008
Location: , , .
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default Help - How to create a Login tracker?

As my title suggests, I want to create a form that can track who and when did the people logs in .

First of all, I have no clue how to start off and hence I would like help, advices or sample codes to see it as reference.

Anyway, I have created a Login form where it validates its credentials via an acess file, which is also my database.

this is the code of my login form in case you need it

Imports System.Data
Imports System.Data.OleDb

Public Class Login

    Public Sub login()
        Dim userName As String = Me.txtLoginName.Text.Trim
        Dim userPassword As String = Me.txtLoginPassword.Text.Trim
        'Connection Part
        Dim ConnString As String = "PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source = C:\Documents and Settings\Administrator\Desktop\New Folder\New Folder\Proj1.mdb"
        Dim connection As New OleDbConnection(ConnString)
        Dim command As New OleDbCommand("SELECT COUNT(*) FROM Users WHERE Login = @Login AND Password = @Password", connection)

        With command.Parameters
            .AddWithValue("@Login", userName)
            .AddWithValue("@Password", userPassword)
        End With

        connection.Open()

        Dim tempBoolean As Boolean = False
        If CInt(command.ExecuteScalar()) = 0 Then
            MsgBox("Access Denied - Login Again", , "Login Form")
        Else
            tempBoolean = True
            MsgBox("Access Granted", , "Login Form")
        End If
        connection.Close()

        If tempBoolean Then
            Me.Hide()
            Admin.Show()
        Else
            'Present the screen if login fails
            Me.Show()
            'Clear the contents
            txtLoginName.Text = String.Empty
            txtLoginPassword.Text = String.Empty
        End If
    End Sub

    Private Sub btnOK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOK.Click

        If txtLoginName.Text = String.Empty And txtLoginPassword.Text = String.Empty Then
            MsgBox("Please enter your Login Name and Password")
        ElseIf txtLoginName.Text = String.Empty Then
            MsgBox("Please enter your Login Name", , "Login Form")
        ElseIf txtLoginPassword.Text = String.Empty Then
            MsgBox("Please enter in your Password", , "Login Form")
        End If

        login()
    End Sub

    Private Sub btnCancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCancel.Click
        Application.Exit()
    End Sub
End Class

Thanks in advance

Reply With Quote
  #2 (permalink)  
Old August 1st, 2008, 10:39 AM
planoie's Avatar
Friend of Wrox
Points: 16,481, Level: 55
Points: 16,481, Level: 55 Points: 16,481, Level: 55 Points: 16,481, Level: 55
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2003
Location: Clifton Park, New York, USA.
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

This should simply be a matter of writing a database record after each login occurs.

-Peter
compiledthoughts.com
Reply With Quote
  #3 (permalink)  
Old August 3rd, 2008, 10:42 PM
Registered User
 
Join Date: Jul 2008
Location: , , .
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
quote:Originally posted by planoie
 This should simply be a matter of writing a database record after each login occurs.

-Peter
compiledthoughts.com
Yeah, but the thing now is that I do not know how to start off the code with... I am currently new to the software and hence I am not sure how to write the code.

And not to mention that it will be a matter of writing database record afer each login occurs...

Reply With Quote
  #4 (permalink)  
Old August 4th, 2008, 09:07 AM
planoie's Avatar
Friend of Wrox
Points: 16,481, Level: 55
Points: 16,481, Level: 55 Points: 16,481, Level: 55 Points: 16,481, Level: 55
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2003
Location: Clifton Park, New York, USA.
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts
Default

Sorry if I have over-assumed. You posted code that is already making database queries so I figured that you understand how to interact with the database and write DB queries.

You need to have a table in which you will put your login history and then a query to insert a row each time a user logs in. If you need help with this, you might want to look into getting an introductory database book.

-Peter
compiledthoughts.com
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to create the login curiaquita VB.NET 4 June 4th, 2008 07:13 AM
Blog - Can login but, cannot create new entry j.t.w BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 13 January 24th, 2007 03:15 PM
Permissions required to create Database Login mvsuresh01 SQL Server 2005 1 October 19th, 2006 08:51 AM
HELP! Create login with DreamweaverMX/Access 2002 aepling Access ASP 1 January 30th, 2004 12:19 PM
Please Help! Attempt to create a login page nvillare Classic ASP Basics 8 August 12th, 2003 09:06 PM



All times are GMT -4. The time now is 02:08 PM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.