Click here to Skip to main content
15,893,486 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
Hi guys.. i am working on a log in system in vb 2010.

All is working quite well but i still don't know how to check username availability.

Im using Access database.
Posted

 
Share this answer
 
Comments
kimsnap 1-Mar-12 7:31am    
Thank you sir, i will try this and get back when i see the result :)
uspatel 1-Mar-12 7:32am    
Your welcome......
kimsnap 1-Mar-12 7:35am    
Hi, ive seen the program and it is written in a language i dont understand..
i am working with vb.net ..
uspatel 1-Mar-12 7:41am    
It is ASP code, You can take an idea how it does works....
see check.asp,check_avilability.js and use it vb.net with ADO.Net
kimsnap 1-Mar-12 7:52am    
okay, i will do that. Thank you. :)
VB
'START .
        Dim conn = New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;" & _
    "Data Source=" & Application.StartupPath & "\DBase.accdb;")
        conn.Open()
        Dim Str As String
        Str = "SELECT * FROM DB WHERE [Username] = '" & UsernameTextBox.Text & "'"
        Dim cmmd = New OleDbCommand(Str, conn)
        Dim dr As OleDbDataReader
        dr = cmmd.ExecuteReader()

        If Not dr.HasRows Then
            MsgBox("Username available.")
            'REST OF THE PROGRAM

        Else
            MsgBox("Username already taken. Try another.")
        End If

        'END
 
Share this answer
 
v2
Comments
Member 9878682 6-Mar-13 7:37am    
what if it selected two fields in database?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900