Lab 7:Write a Visual Basic Program to implement username and password
Private Sub Command1_Click()
Dim str1 As String
Dim str2 As String
str1 = (Text1.Text)
str2 = (Text2.Text)
Adodc1.RecordSource = "select * from userpwd where username='" & str1 & "' and password='" & str2 & "'"
Adodc1.Refresh
If Adodc1.Recordset.RecordCount = 0 Then
MsgBox ("invalid login")
Else
MsgBox ("login successful")
End If
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Dim str1 As String
Dim str2 As String
str1 = (Text1.Text)
str2 = (Text2.Text)
Adodc1.RecordSource = "select * from userpwd where username='" & str1 & "' and password='" & str2 & "'"
Adodc1.Refresh
If Adodc1.Recordset.RecordCount = 0 Then
MsgBox ("invalid login")
Else
MsgBox ("login successful")
End If
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Leave a Comment