I need your help

i'm using access database
create simple login form
in the database record Username is Admin or Password is Admin
so i wanna need this add username and save record ask me record already available

how to do this on vb.net 2010 or 2012

looks like this

Recommended Answers

All 2 Replies

What do you have so far?

Some days ago I do the same as you want.

 Private Sub ToolStripLabel4_Click(sender As System.Object, e As System.EventArgs) Handles ToolStripLabel4.Click

        If (ValidateUser() = False) Then Return

        Dim UserCommand As New System.Data.SqlClient.SqlCommand

        If distributionDB.State = ConnectionState.Closed Then
        End If

        UserCommand.CommandText = "Select Count(UserID) From DistUser Where UserID=@UsID"
        UserCommand.Parameters.Add("@UsID", SqlDbType.VarChar, 50).Value = uID
        UserCommand.Connection = distributionDB

        Dim uCount As Integer = UserCommand.ExecuteScalar()

        If uCount > 0 Then
            Dim x As String = String.Format("User Name {0} already exists.{1}Please input a unique user name.", TextBox1.Text, vbCrLf)
            MsgBox(x, MsgBoxStyle.OkOnly + MsgBoxStyle.Exclamation, "User...")
            Exit Sub
        End If

        Me.DialogResult = Windows.Forms.DialogResult.OK

    End Sub

    Private Function ValidateUser() As Boolean
        On Error Resume Next

        If (Trim(TextBox1.Text) = "") Then
            MsgBox("The User name is required.", MsgBoxStyle.OkOnly Or MsgBoxStyle.Exclamation, ApplName)
            Return False
        End If

        Return True

    End Function

You can try it if you like it. I also Used MsSQL database system, you have to use the OleDb Connection for your Access Database. Alter them and try it.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.