CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Nov 2006
    Posts
    37

    getting the data from the database

    I want to create a banking management system using vb.net. I have already created all the forms in vb.net. The main form is the login form, where the customer has to enter his or her username and password. If the username and password entered are correct, then the customer will be able to log in. Else, an error message will pop up.

    These usernames and password details are stored in the Microsoft Access Database in a table named customer detail.

    I am stuck in the part where i have to write the code to get these usernames and passwords from the customer detail table.

    I have already done the connection,the data adapter and data set parts to connect and get information from the customer details table.

  2. #2
    Join Date
    Sep 2006
    Location
    Beyrouth VB.Net 2005
    Posts
    70

    Re: getting the data from the database

    ok so now you have the dataset try this:
    Dim i As Integer

    For i = 0 To DS.Tables("Users").Rows.Count - 1
    If Trim(txtLogIn.Text) = DS.Tables("Users").Rows(i)("Name") AndAlso Trim(txtPassword.Text) = DS.Tables("Users").Rows(i)("Password") Then
    End If

    Next

    If i = DS.Tables("Users").Rows.Count Then
    MessageBox.Show("User or password incorrect,please try again!", MyCaption, MessageBoxButtons.OK, MessageBoxIcon.Exclamation)

    End If
    Nagham VB.Net2005

  3. #3
    Join Date
    Jun 2004
    Location
    Kashmir, India
    Posts
    6,808

    Re: getting the data from the database

    It is not a good idea to get all the data regarding UserNames and passwords from the database. Rathjer you can check using a simple query whether the Username amd password entered by the user are correct or not.

    Something like this
    Code:
    Select count(*) From USERTABLE Where USERNAME = 'enteredusername' And Password = 'enteredpassword'
    If this query returns 0 then the username and password are invalid.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured