Question : Need to speed up authentication of MS SQL Server database records using VB5

Is there a way to speed up the opening and searching for a record in MSSQL database running on a server?  The client computer is running a VB5 application with an internet connection.  The line where the delay occurs is,

    RSARRAY = RS4.getRows()

Is there a faster way to open the connection to the server table then find a record in the table?
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
Dim ConnObj As New ADODB.Connection 'ADODB Connection Object
Dim RS4 As New ADODB.Recordset 'Recordset Object
Dim SQL4 As String ' String variable to store sql command
   
    
'CONNECTION STRING TO SQL DATABASE
ConnObj.Open _
        "Provider = sqloledb;" & _
        "Data Source=69.62.203.176,1433\pe1850sql;" & _
        "Initial Catalog=GOUAL;" & _
        "User ID=sa;" & _
        "Password=***********;"
        
    
'CHECK IF USER EXIST IN PROFILES TABLE
SQL4 = " SELECT * FROM PROFILES " & " WHERE FNO='" & paddedFN & "' "
RS4.Open SQL4, ConnObj, adOpenKeyset

If Not RS4.EOF Then
    RSARRAY = RS4.getRows()
        NR = UBound(RSARRAY, 2) + 1
    Else
        NR = 0
End If
RS4.Close
If NR > 0 Then
    CUSTOMEREXISTS = True
Else
    CUSTOMEREXISTS = False
    GoTo Process_Variables
End If

Answer : Need to speed up authentication of MS SQL Server database records using VB5

If you are concerned about speed than use a Forward=Only and not a Keyset cursor.  And if you want simplicity, than this is the simplest you are going to get:
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
Dim ConnObj As ADODB.Connection
Dim RS As ADODB.Recordset
Dim SQL As String

Set ConnObj = New ADODB.Connection
    
'CONNECTION STRING TO SQL DATABASE
ConnObj.Open _
        "Provider = sqloledb;" & _
        "Data Source=69.62.203.176,1433\pe1850sql;" & _
        "Initial Catalog=GOUAL;" & _
        "User ID=sa;" & _
        "Password=***********;"
        
SQL = "SELECT 1 FROM INVDETAILS INNER JOIN PROFILES ON INVDETAILS.UAID = PROFILES.UAID " & _
" WHERE INVDETAILS.SVCCODE='" & XSCODE & "' AND PROFILES.FNO='" & paddedFN & "' " & _
" AND INVDETAILS.PASSCODE='" & PassCode & "' AND INVDETAILS.ACTIVE=1; "
Set RS = ConnObj.Execute(SQL)

RecordFound = NOT RS.EOF

RS.Close
ConnObj.Close

Set RS = Nothing
Set ConnObj = Nothing
Random Solutions  
 
programming4us programming4us