Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Login coding

nozihozinozihozi Posts: 6Member
Ive created a form(VB.net) for logging in and made a command Login. What coding can i write to check wether the correct logins have been inputed.I made a table on Access called Users and it has 2 fields UserID being the primary key and Password.

Please help!!!!!!!!!!!

Comments

  • pranavaidyapranavaidya Posts: 6Member
    : Ive created a form(VB.net) for logging in and made a command Login. What coding can i write to check wether the correct logins have been inputed.I made a table on Access called Users and it has 2 fields UserID being the primary key and Password.
    :
    : Please help!!!!!!!!!!!
    :
    :

    Hi !!
    You can go through following few things :
    - Create a OLEDBDataAdapter Object with MS-Access DB connection.
    - Create a Dataset, Right-clicking on Adapter object on Form.
    - When You call Login, you
    - First call "Fill" method of Adapter.
    - Then create object for BindingManagerBase.
    - Get objBMB = Me.BindingContext(DatasetName,TableName)
    - Keep track of objBMB.position while checking Username & Pwd with updating position.

  • nozihozinozihozi Posts: 6Member
    : : Ive created a form(VB.net) for logging in and made a command Login. What coding can i write to check wether the correct logins have been inputed.I made a table on Access called Users and it has 2 fields UserID being the primary key and Password.
    : :
    : : Please help!!!!!!!!!!!
    : :
    : :
    :
    : Hi !!
    : You can go through following few things :
    : - Create a OLEDBDataAdapter Object with MS-Access DB connection.
    : - Create a Dataset, Right-clicking on Adapter object on Form.
    : - When You call Login, you
    : - First call "Fill" method of Adapter.
    : - Then create object for BindingManagerBase.
    : - Get objBMB = Me.BindingContext(DatasetName,TableName)
    : - Keep track of objBMB.position while checking Username & Pwd with updating position.
    :
    : Thanks,

    But can you help me with a bit of the coding, thing is i'm new in this .Net environment.

    Thanks in advance.



  • redrhydoredrhydo Posts: 3Member
    You can go through following few things :
    - Create a OLEDBDataAdapter Object with MS-Access DB connection.
    - Create a Dataset, Right-clicking on Adapter object on Form.
    - When You call Login, you
    - First call "Fill" method of Adapter.
    - Then create object for BindingManagerBase.
    - Get objBMB = Me.BindingContext(DatasetName,TableName)
    - Keep track of objBMB.position while checking Username & Pwd with updating position.
  • MegaMasterXMegaMasterX Posts: 13Member
    If you are wanting to do specific credentials, you could just make a code to check the textboxes for user name and password...I dont' know if this will help but:

    if textbox1.text = "MyUser" and textbox2.text = "MyPassword" then
    msgbox ("Welcome to the system!",MsgBoxStyle.Information,"Welcome")
    ElseIf Textbox1.text = "MyUser2" and TextBox2.text = "MyPassword2" then
    Msgbox ("Your user has been restricted",MsgBoxStyle.Critical,"Notice")
    End If

    And so on
    ----------
    Mess with the Best, Die like the Rest!
    ----------
    http://www.graalonline.com
    Get started today!

  • SerameSerame Posts: 2Member
    : not knowing how many users are stored in the database and their passwords

    //retrieve the details first
    OledbDataAdapter.fill(d_set)

    //declare a dataTable to store the dataSet contents
    d_set

    dim dataTable as DataTable = d_set.Tables("TableName")

    'compare retrieved values from the controls and the ones in the database

    if dataTable.Rows.Count > 1 then //this is only to avoid throwing an exception by the program if you just go straight to testing.

    dim counter as integer

    for counter = 0 to dataTable.Rows.Count -1

    //the first argument of the Rows method is a row and the second one is a column so you can specify the column name as in your Table
    if dataTable.Rows(counter)("UserName") = "Username" AndAlso dataTable.Rows(counter)("Password") = "Password"

    Messaagebox.show("Login Authorized")
    next

    end if

    //i hope this will solve your problem




Sign In or Register to comment.