Add a Admin in Login with databsae

chow980161

New member
Joined
May 5, 2010
Messages
1
Programming Experience
Beginner
hello,i first time to ask question...........:D
i do how to add a admin :(


VB.NET:
Public Class Form2
    Public login As Boolean = False
    Dim dt As New DataTable

    Private Sub btnSubmit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSubmit.Click
        Dim UserFound As Boolean = False
        If (txtUsername.Text = Nothing) Or (txtPassword.Text = Nothing) Then
            MsgBox("Missing username or password. Please try again.")
            txtUsername.Clear()
            txtPassword.Clear()
        Else
        End If

        For i As Integer = 0 To (dt.Rows.Count - 1)
            If CStr(dt.Rows(i)("StaffName")) = txtUsername.Text And _
                 CStr(dt.Rows(i)("Password")) = txtPassword.Text Then
                UserFound = True
                Form3.Show()
            End If
        Next
        If UserFound Then
            login = True
            Me.Close()

        Else
            MsgBox("Wrong username or password. Please try again.")
            login = False
            txtUsername.Clear()
            txtPassword.Clear()

        [COLOR="Red"][B][U]    Dim arow As DataRow
            arow = TourDataSet.Staff.FindbyStaffName("Admin")
            If arow Is Nothing Then MsgBox("no such user")
Else
            End If
        If DataRow("password") = "admin" Then
            MsgBox("login OK")

        End If
        [/U][/B]

    End Sub
[/COLOR]
 
Back
Top