Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Selecting a single data value from a database in VB6

Options
  • 28-07-2006 12:44am
    #1
    Registered Users Posts: 24,249 ✭✭✭✭


    I'm sure this is a completely stupid question but it's over 3 years since I've touched VB and I'm finding I'm rustier than I thought!

    I'm looking to return a single piece of data from a SQL Server / Access Database in VB6 rather than creating a datagrid or opening a full table in a recordset.

    Basically I'm trying to code a login screen that checks the password against a field in a database table

    Or in psesudocode:
    dim strBox1 as String
    dim strBox2 as String
    dim strSQL as String
    dim strSQLResult as String
    
    strBox1 = txtBox1.Text
    strBox2 = txtBox2.Text
    
    strSQL = "Select password from user where user_id = " & strBox1
    
    strSQLResult = *Result from running strSQL against database*
    
    If strBox2 = strSQLResult Then
        frmMain.show
        me.hide
    Else
        end
    End If
    


Advertisement