If TextBox1.Text = "" Then
MsgBox("Please enter your Username.", MsgBoxStyle.Critical)
End If
If TextBox2.Text = "" Then
MsgBox("Please enter your Password.", MsgBoxStyle.Critical)
End If
con.ConnectionString = ("Data Source=IT03;Initial Catalog=ADO_JOMuser;Integrated Security=True;Pooling=False")
cmd.CommandText = "SELECT * FROM [UserReg] WHERE Username = '" & TextBox1.Text & "' and Password = '" & TextBox2.Text & "';"
con.Open()
cmd.Connection = con
da.SelectCommand = cmd
da.Fill(ds, "0")
Dim count = ds.Tables(0).Rows.Count
If count > 0 Then
Form1.Show()
Me.Hide()
ElseIf attempts = 5 Then
MsgBox("This program will automatically close due to unknown user.", MsgBoxStyle.Critical)
Me.Close()
Else
MsgBox("Invalid Username/Password! Please make that you enter the correct Username/Password. " & attempts & " of 5", MsgBoxStyle.Critical)
attempts = attempts + 1
TextBox1.Clear()
TextBox2.Clear()
TextBox1.Focus()
End If
that is my coding in log in button my problem is how to save the username when he try to log in in the system
MsgBox("Please enter your Username.", MsgBoxStyle.Critical)
End If
If TextBox2.Text = "" Then
MsgBox("Please enter your Password.", MsgBoxStyle.Critical)
End If
con.ConnectionString = ("Data Source=IT03;Initial Catalog=ADO_JOMuser;Integrated Security=True;Pooling=False")
cmd.CommandText = "SELECT * FROM [UserReg] WHERE Username = '" & TextBox1.Text & "' and Password = '" & TextBox2.Text & "';"
con.Open()
cmd.Connection = con
da.SelectCommand = cmd
da.Fill(ds, "0")
Dim count = ds.Tables(0).Rows.Count
If count > 0 Then
Form1.Show()
Me.Hide()
ElseIf attempts = 5 Then
MsgBox("This program will automatically close due to unknown user.", MsgBoxStyle.Critical)
Me.Close()
Else
MsgBox("Invalid Username/Password! Please make that you enter the correct Username/Password. " & attempts & " of 5", MsgBoxStyle.Critical)
attempts = attempts + 1
TextBox1.Clear()
TextBox2.Clear()
TextBox1.Focus()
End If
that is my coding in log in button my problem is how to save the username when he try to log in in the system