C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Communities   Interview   Jobs   Projects   Offshore Development    
Silverlight Tutorials | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Revenue Sharing |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...

New Feature: Community Sites: Create your own .NET community website and start earning from Google AdSense ! It's Free !






Authenticating usernames and passwords from database


Posted Date: 22 Aug 2008    Resource Type: Articles    Category: General

Posted By: Initiotech       Member Level: Gold
Rating:     Points: 10



Hi My Name is Hefin Dsouza.
From the very beginning i was in search for a simple way to authenticate users from a database there were many ways to do it.
But all very complex so I was researching for a simple trick to complete my task and here it is.
The Trick goes like this.
Problem : I want to Authenticate username and passwords from users using VB.net where the user names and passwords are stored in the database.


Solution : Create a table with the username and password column add some details and save the table.


Now come the interesting part of connecting your application to your database and validate the Logins

In your login form where you may have two textbox’s for username and password.

On The Login buttons Click Event Write the Following Code.

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim tex As String = "select * from login where username='" + TextBox1.Text + "' and [password]='" + TextBox2.Text + "'"
dataAdap = New OleDbDataAdapter(tex, dataCon)
dTable.Clear()
dataAdap.Fill(dTable)
If dTable.Rows.Count <> 0 Then
MsgBox("Login Successfull", MsgBoxStyle.Information, "Login")
Else
MsgBox("Login UnSuccessfull", MsgBoxStyle.Critical, "Login")
End If
End Sub

That’s it And All Work Done and a Simple Login Box is ready to use.

This is a Simple way to Authenticate users in your application in a quick way.


If You have a better code please let me know.

Regards
Hefin Dsouza



Attachments

  • Complete Article with Screen Shots (20419-22621-Hi My Name is Hefin Dsouza.doc)
  • Download the Source Code of an dummy Login Application (20419-22623-Login.zip)



  • Responses


    No responses found. Be the first to respond and make money from revenue sharing program.

    Feedbacks      
    Popular Tags   What are tags ?   Search Tags  
    Vb.net  .  Login  .  Database  .  

    Post Feedback


    This is a strictly moderated forum. Only approved messages will appear in the site. Please use 'Spell Check' in Google toolbar before you submit.
    You must Sign In to post a response.
    Next Resource: Execute a new microsoft word
    Previous Resource: Keyboard CapsLock On/OFF
    Return to Discussion Resource Index
    Post New Resource
    Category: General


    Post resources and earn money!
     
    Related Resources



    dotNet Slackers   BizTalk Adaptors    Web Design

    teleconferencing service

    Contact Us    Privacy Policy    Terms Of Use