How to use multi user login with visual basic 6 and Microsoft access 2007
-
Please I need to know the right code to use to access stored user logins in Microsoft access from visual basic 6 login form. Kindly assist as the code i used is not connecting.
Adodc1.RecordSource = "SELECT * FROM LoginTB WHERE username ='" +
txtUserName.Text + "'"
Adodc1.RefreshIf (Adodc1.Recordset.EOF = False) Then If (txtPassword.Text = Adodc1.Recordset.Fields
("Password")) Then
MsgBox ("Login Successful")
Else
MsgBox ("Login Failure. Incorrect Password")
End If
Else
MsgBox ("Login Failure. Username does not exist.")
End If -
Please I need to know the right code to use to access stored user logins in Microsoft access from visual basic 6 login form. Kindly assist as the code i used is not connecting.
Adodc1.RecordSource = "SELECT * FROM LoginTB WHERE username ='" +
txtUserName.Text + "'"
Adodc1.RefreshIf (Adodc1.Recordset.EOF = False) Then If (txtPassword.Text = Adodc1.Recordset.Fields
("Password")) Then
MsgBox ("Login Successful")
Else
MsgBox ("Login Failure. Incorrect Password")
End If
Else
MsgBox ("Login Failure. Username does not exist.")
End If -
Please I need to know the right code to use to access stored user logins in Microsoft access from visual basic 6 login form. Kindly assist as the code i used is not connecting.
Adodc1.RecordSource = "SELECT * FROM LoginTB WHERE username ='" +
txtUserName.Text + "'"
Adodc1.RefreshIf (Adodc1.Recordset.EOF = False) Then If (txtPassword.Text = Adodc1.Recordset.Fields
("Password")) Then
MsgBox ("Login Successful")
Else
MsgBox ("Login Failure. Incorrect Password")
End If
Else
MsgBox ("Login Failure. Username does not exist.")
End IfYou seem to be copying and pasting code together, knowing nothing about the code you're using, hoping the frankenstein assemblage you're building works. True?
Asking questions is a skill CodeProject Forum Guidelines Google: C# How to debug code Seriously, go read these articles.
Dave Kreskowiak -
Please I need to know the right code to use to access stored user logins in Microsoft access from visual basic 6 login form. Kindly assist as the code i used is not connecting.
Adodc1.RecordSource = "SELECT * FROM LoginTB WHERE username ='" +
txtUserName.Text + "'"
Adodc1.RefreshIf (Adodc1.Recordset.EOF = False) Then If (txtPassword.Text = Adodc1.Recordset.Fields
("Password")) Then
MsgBox ("Login Successful")
Else
MsgBox ("Login Failure. Incorrect Password")
End If
Else
MsgBox ("Login Failure. Username does not exist.")
End IfMember 13691861 wrote:
"SELECT * FROM LoginTB WHERE username ='" + txtUserName.Text + "'"
Not like that! :doh: Everything you wanted to know about SQL injection (but were afraid to ask) | Troy Hunt[^] How can I explain SQL injection without technical jargon? | Information Security Stack Exchange[^] Query Parameterization Cheat Sheet | OWASP[^] Also: Secure Password Authentication Explained Simply[^] Salted Password Hashing - Doing it Right[^]
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
-
Please I need to know the right code to use to access stored user logins in Microsoft access from visual basic 6 login form. Kindly assist as the code i used is not connecting.
Adodc1.RecordSource = "SELECT * FROM LoginTB WHERE username ='" +
txtUserName.Text + "'"
Adodc1.RefreshIf (Adodc1.Recordset.EOF = False) Then If (txtPassword.Text = Adodc1.Recordset.Fields
("Password")) Then
MsgBox ("Login Successful")
Else
MsgBox ("Login Failure. Incorrect Password")
End If
Else
MsgBox ("Login Failure. Username does not exist.")
End If -
Member 13691861 wrote:
"SELECT * FROM LoginTB WHERE username ='" + txtUserName.Text + "'"
Not like that! :doh: Everything you wanted to know about SQL injection (but were afraid to ask) | Troy Hunt[^] How can I explain SQL injection without technical jargon? | Information Security Stack Exchange[^] Query Parameterization Cheat Sheet | OWASP[^] Also: Secure Password Authentication Explained Simply[^] Salted Password Hashing - Doing it Right[^]
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
I think SQL injection is the least of his problems :sigh:
Never underestimate the power of human stupidity RAH
-
Please I need to know the right code to use to access stored user logins in Microsoft access from visual basic 6 login form. Kindly assist as the code i used is not connecting.
Adodc1.RecordSource = "SELECT * FROM LoginTB WHERE username ='" +
txtUserName.Text + "'"
Adodc1.RefreshIf (Adodc1.Recordset.EOF = False) Then If (txtPassword.Text = Adodc1.Recordset.Fields
("Password")) Then
MsgBox ("Login Successful")
Else
MsgBox ("Login Failure. Incorrect Password")
End If
Else
MsgBox ("Login Failure. Username does not exist.")
End IfVB6 is no longer supported, and no new code should be written in the language. The compiler isn't sold anymore, and there's no OS for sale that still supports it. There's several problems with your code, SQL-injection just being one of them. You're also storing passwords, which is a security issue. If you want to learn to code then upgrade to VB.NET; if this is part of a course or schoolwork, then I suggest you demand your money back.
Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^] "If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
-
VB6 is no longer supported, and no new code should be written in the language. The compiler isn't sold anymore, and there's no OS for sale that still supports it. There's several problems with your code, SQL-injection just being one of them. You're also storing passwords, which is a security issue. If you want to learn to code then upgrade to VB.NET; if this is part of a course or schoolwork, then I suggest you demand your money back.
Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^] "If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
Thanks for your response, I am on the verge of upgrading to VB.net. However I need to complete this project. If you still have an idea on how to generate this in VB 6. I will very much appreciate. Thanks
-
Thanks for your response, I am on the verge of upgrading to VB.net. However I need to complete this project. If you still have an idea on how to generate this in VB 6. I will very much appreciate. Thanks
Your solution is insecure, in an unsupported language. I oppose both the use of VB6 (a waste of your clients time and money) and the way you're implementing it. Just hardcode a general password in that form and be done with it. If you don't take it seriously, then why should I?
Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^] "If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.