Click here to Skip to main content
15,891,943 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
VB
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
      Dim a As Integer
      a = Me.UserlogTableAdapter1.userquery(Me.UserlogDataSet1.userlog, txtUsername.Text, txtPassword.Text)
      If a = 1 Then
          txtUsername.Text = ""
          txtPassword.Text = ""
          Button1.Enabled = False
          txtUsername.Focus()
          form2.Show()
      Else
          Button1.Enabled = False
          txtPassword.Text = ""
          txtUsername.Focus()
          txtUsername.SelectAll()
          c = c + 1
          Select Case c
              Case 1
                  MsgBox("incorrect username or password.", MsgBoxStyle.Exclamation)
              Case 2
                  MsgBox("incorrect blah blah blah", MsgBoxStyle.Exclamation)
              Case Else
                  Application.Exit()
          End Select
      End If
  End Sub

-------------------------------------------
vb.net2003

in my data adapter config wizard.. i loaded into the dataset.. "select UserName, Password from Login where Username = @Param3 and Password = @Param4

:: i think i don't understand the codings in vb.net..

VB
Private sub cmdLog_Click_1(ByVal sender as System.Object, byVal e As system.EventArgs) Handles cmdLog.Click
    Me.CreateParameter(txtUsername.text, txtPassword.text)
end Sub

Private function CreateParameter(ByVal Param3,Byval Param4) As System.Data.sqlClient.sqlParameter()
try
    sqlSelectCommand1.Parameters("@Param3").Value=trim(Param3)
    sqlSelectCommand1.Parameters("@Param4").Value=trim(Param4)
    

    'c=Me,SqlDataAdapter.SelectCommand.Commandtext()
    'sqlSelectcommand1.CommandType=CommandType.text

    'sqlConnection1.Open()
    '''??
    'sqlConnection1.Close()

    if dataset12.Login.Rows.Count>0 then
        dim frmx As new Form2
        frmx.show()
    else
        counter = counter + 
    Catch ex As Expetion
end try
Posted

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