Results 1 to 2 of 2
  1. #1
    Join Date
    Sep 2002
    Location
    USA
    Posts
    2

    Unhappy VB Customize login screen

    I am currently creating a username & password login in visual basic, and the user information is stored in SQL 7.0 Server.

    I can established the connection from vb to sql connection, but i cannot figure out the proper code when clicking OK button to verify if the user exist in the sql table. Please help!

    Here is the code to connect to sql server on form load.

    Dim objConn As Connection
    Set objConn = New Connection
    objConn.Open "Provider=MSDASQL.1;Password=logjam;Persist
    Security Info=True;" & _
    "User ID=powerseller;Data Source=PowersellerDEV;Initial Catalog=Powerseller"

    Here is the code as a recordset.

    Dim objRec As Recordset
    Set objRec = New ADODB.RecordSet
    objRec.Open "SELECT user_code, user_name, user_level from tblusers", objconn, adOpenstatic, adLockOptimistic, acCmdText

    Somehow, I got lost on this part. I need to determine that when I input a username & password it will go back to tblusers table and verify if it is a valid username & password before loading the next form, it its invalid it should display a message and loop until a valid username & password is met. You immediate help will be highly appreciated. Thanks.


    Last edited by bentotzky; 09-16-02 at 12:52.

  2. #2
    Join Date
    Feb 2002
    Posts
    2,232
    Use select count(*) instead - test for rs(0) = 0; if true loop else load form.

Posting Permissions

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