0% found this document useful (0 votes)
381 views3 pages

Username and Password: ' 'These Codes Will Create A Logon Using Inputboxes That IS Case Sensitive. '

The document contains code for logging in a user by checking the username and password against values stored in a database. It includes code to open a connection to the database, retrieve the matching record, and check if the username and password entered by the user match the values in the database record. If they match, it shows a login successful message, otherwise it shows an invalid credentials message. There is also additional code to set a new password for a user by inserting a new record into the passwords table.

Uploaded by

Nanda Kumar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
381 views3 pages

Username and Password: ' 'These Codes Will Create A Logon Using Inputboxes That IS Case Sensitive. '

The document contains code for logging in a user by checking the username and password against values stored in a database. It includes code to open a connection to the database, retrieve the matching record, and check if the username and password entered by the user match the values in the database record. If they match, it shows a login successful message, otherwise it shows an invalid credentials message. There is also additional code to set a new password for a user by inserting a new record into the passwords table.

Uploaded by

Nanda Kumar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

USERNAME AND PASSWORD

1. Private Sub log_in( )


2.
3. if text1.text=("nathan") and text2.text=("cute") then
4. form2.show
5. me.hide
6. else
7. msgbox "sorry try to review ur username and password
8. End sub

'
'These codes will create a logon using Inputboxes that IS Case Sensitive.
'

Declaration
dim rs as new adodb.recordset
dim conn as new adodb.connection
dim sql as string
sql = select * from Login Table
conn.Open Provider=Microsoft.Jet.OLEDB.4.0;Data Source= & App.Path & \BRWSA.mdb;Jet
OLEDB:Database Password=Admin; connection
rs.Open sql, conn, adOpenStatic, adLockOptimistic
rs.find username=text1.text
while rs.EOF
wend
rs.movefirst
if rs.field!Username=text1.text then
if rs.field!password=text2.text then
msgboxwelcome,vbinformation,Login
else
msgboxinvalid password,vbcritical,Password
end if
else
msgboxinvalid username,vbcritical,Username
end if

01
Private Sub cmdok_Click()
02
Static y As Integer
03 Adodc1.Refresh
04
With Adodc1.Recordset
05

06
If .RecordCount > 0 Then
07
If !UserName = txtUsername And !Password = txtPassword Then
08 MsgBox "Login Successful!"
09 frmMenu.Show
10 Unload Me
11 Else
12
MsgBox "Invalid username/password!", vbOKOnly +
vbCritical, "Access denied!"
13 txtUsername.Text = ""
14 txtPassword.Text = ""
15 txtUsername.SetFocus
16
End If
17
End With
18
End Sub
' Set a new password for the user.
Private Sub btnSetPassword_Click(ByVal sender As _
System.Object, ByVal e As System.EventArgs) Handles _
btnSetPassword.Click
' Open the database.
Dim conn As OleDbConnection = GetDbConnection()

' Delete any existing record.
Dim query As String
Dim cmd As New OleDbCommand
query = "DELETE FROM Passwords WHERE UserName='" & _
txtUserName.Text & "'"
cmd = New OleDbCommand(query, conn)
cmd.ExecuteNonQuery()

' Insert the new record.
query = "INSERT INTO Passwords VALUES ('" & _
txtUserName.Text & "', '" & _
HashPassword(txtPassword.Text) & "')"
cmd = New OleDbCommand(query, conn)
cmd.ExecuteNonQuery()

' Close the connection.
conn.Close()
conn.Dispose()

MessageBox.Show("Ok")
End Sub
Ole:
Syntax
object.OLETypeAllowed [ = value]
Syntax
object.Options [ = value ]
Syntax
object.CheckBox [= boolean]
Syntax
object.CommandText [=string]
Syntax
object.DataGrid
Syntax
object.Drive
Sub ShowFileAccessInfo(filespec)
Dim fs, f, s
Set fs = CreateObject("Scripting.FileSystemObject")
Set f = fs.GetFile(filespec)
s = f.Name & " on Drive " & UCase(f.Drive) & vbCrLf
s = s & "Created: " & f.DateCreated & vbCrLf
s = s & "Last Accessed: " & f.DateLastAccessed & vbCrLf
s = s & "Last Modified: " & f.DateLastModified
MsgBox s, 0, "File Access Info"
End Sub
Syntax
object.Frame
erode to Madurai by train
trno 22629 16734 19568 16236 price 708 to 138

You might also like