[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 259
  • Last Modified:

User Validation on a Windows Form

I have a table in my db that stores usernames and passwords. I have a form (VB.NET) that has a username & pasword field that I want to validate against the db (i'm only interested in very basic security for this app anyway) . I have also set up the adapater & dataset and bound the controls.

I've looked all over the net for some advice but can only find .ASP login forms. How can I authenticate the text supplied in both fields against my db?
0
Craig_Muckleston
Asked:
Craig_Muckleston
3 Solutions
 
khngCommented:
you can use a simple query like this one:

SELECT COUNT(*)
FROM user_table
WHERE user_id=text_box_text AND user_password=text_box_text;

This query return 1 on only if the id and password are corresponding to a single row.
Otherwise, 0 return invalid login
0
 
TheHartfordCommented:
You can have a stored procedure in your db and validate it using SQL stmts. Pass ur userid and password as a parameters to the stored proceudure

hope that helps !

RR
0
 
Aldur1Commented:
personally i would just use this

passwordsRS.movefirst
for i = 1 to passwordsRS.recordcount
if PasswordsRS![Username] = txtUsername.text and PasswordsRS![Password] = txtPword.text then
frmLogin.hide
frmMain.show
else
PasswordsRS.movenext
end if
next i

if PasswordsRS.eof = true then
msgbox "Invalid Username or Password", VBOKOnly, "Login"
end if
0

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now