User Validation on a Windows Form

Posted on 2004-11-16
Last Modified: 2010-04-17
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?
Question by:Craig_Muckleston

    Accepted Solution

    you can use a simple query like this one:

    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

    Assisted Solution

    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 !

    LVL 1

    Assisted Solution

    personally i would just use this

    for i = 1 to passwordsRS.recordcount
    if PasswordsRS![Username] = txtUsername.text and PasswordsRS![Password] = txtPword.text then
    end if
    next i

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

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Course: HTML5 Mobile App Development with PhoneGap

    PhoneGap can help you leverage your already existing HTML5, JavaScript, and CSS skills in order to create and deploy cross-platform mobile apps.This program comprehensively covers HTML5 mobile app development from top to bottom.

    Here we come across an interesting topic of coding guidelines while designing automation test scripts. The scope of this article will not be limited to QTP but to an overall extent of using VB Scripting for automation projects. Introduction Now…
    This is an explanation of a simple data model to help parse a JSON feed
    An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
    In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

    737 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now