Hey guys, this is my first post so sorry if this is the wrong forum but im pretty sure im in the right place. I dont usually ask in forums because someone else where has already asked it but i have searched and searched and cannot find an answer that i am looking for.
In a nutshell, i have a very basic login form which is connected to a database [access 2003] and uses IF statements to match the username and passwords. here is the code :
Imports System.Data.OleDb
Public Class LoginForm1
Private Sub OK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OK.Click
Dim con As OleDbConnection = New OleDbConnection("Provider=Microsoft.jet.oledb.4.0;data source = C:\Users\Admin\Desktop\Login\database.mdb")
Dim cmd As OleDbCommand = New OleDbCommand("SELECT username,password FROM table1 where username=? and password=?", con)
If UsernameTextBox.Text = read.Item("username").ToString And PasswordTextBox.Text = read.Item("password").ToString Then
Label1.Text = read.Item("password").ToString
Else
MsgBox("Login unsuccessful, username and passwords are case sensitive")
End If
Else
MsgBox("Login unsuccessful")
End If
read.Close()
Catch ex As Exception
MessageBox.Show(ex.Message)
Finally
con.Close()
End Try
End Sub
Now, this all works handy dandy which i was fairly chuffed at. then i thought, i might as well go all the way and encrypt it. so the plan was..
user = admin
password = 8 (inside the database) however the user chose the password 4.
when back in vb, the user enters : admin ; 4 and the program uses
"if usernametextbox.text = admin and (val(passwordtextbox.text) * 2) then form2.show
so before i go doing 128bit encryption or anything stupid.. i litrally just want to get something as simple as a multiplication password before anything more complex...
Please help me, i already have tuffs of hair missing :(
Thanks in advance and i apologise if i have not explained very well, i know what i want.. but not how to describe it :/
Question
megmut
Hey guys, this is my first post so sorry if this is the wrong forum but im pretty sure im in the right place. I dont usually ask in forums because someone else where has already asked it but i have searched and searched and cannot find an answer that i am looking for.
In a nutshell, i have a very basic login form which is connected to a database [access 2003] and uses IF statements to match the username and passwords. here is the code :
Imports System.Data.OleDb
Public Class LoginForm1
Private Sub OK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OK.Click
Dim con As OleDbConnection = New OleDbConnection("Provider=Microsoft.jet.oledb.4.0;data source = C:\Users\Admin\Desktop\Login\database.mdb")
Dim cmd As OleDbCommand = New OleDbCommand("SELECT username,password FROM table1 where username=? and password=?", con)
cmd.Parameters.AddWithValue("username", UsernameTextBox.Text)
cmd.Parameters.AddWithValue("password", PasswordTextBox.Text)
Try
con.Open()
Dim read As OleDbDataReader = cmd.ExecuteReader()
If read.HasRows Then
read.Read()
If UsernameTextBox.Text = read.Item("username").ToString And PasswordTextBox.Text = read.Item("password").ToString Then
Label1.Text = read.Item("password").ToString
Else
MsgBox("Login unsuccessful, username and passwords are case sensitive")
End If
Else
MsgBox("Login unsuccessful")
End If
read.Close()
Catch ex As Exception
MessageBox.Show(ex.Message)
Finally
con.Close()
End Try
End Sub
Now, this all works handy dandy which i was fairly chuffed at. then i thought, i might as well go all the way and encrypt it. so the plan was..
user = admin
password = 8 (inside the database) however the user chose the password 4.
when back in vb, the user enters : admin ; 4 and the program uses
"if usernametextbox.text = admin and (val(passwordtextbox.text) * 2) then form2.show
so before i go doing 128bit encryption or anything stupid.. i litrally just want to get something as simple as a multiplication password before anything more complex...
Please help me, i already have tuffs of hair missing :(
Thanks in advance and i apologise if i have not explained very well, i know what i want.. but not how to describe it :/
Link to comment
Share on other sites
2 answers to this question
Recommended Posts