troubleshooting Question

Select statement skips records

Avatar of Chris Jones
Chris JonesFlag for United States of America asked on
33 Comments1 Solution312 ViewsLast Modified:
i have a problem with my app when i run it i noticed that it has been skipping records can anyone help me with this
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim rs As ADODB.Recordset ' recorde set for the connection 
        Dim sqlstmt As String
        Dim UIN As String
        Dim PIDM As String
        Dim fname As String
        Dim lname As String
        Dim ct As Integer = 0
        Dim temparray() As String = CType(Session.Item("course"), String())
        Call localDBConnectionOpen()
        sqlstmt = "SELECT * FROM Person"
        rs = DBRecordSetNewFast(ConnPortal, sqlstmt)
        ' checks the users infomation to see if its correct
        While Not rs.EOF
            If CWIDT.Text = "admin" Then
                Session("CWID") = Me.CWIDT.Text.Trim
            End If
            Dim itemsAreNull As Boolean = True
            If Not (temparray Is Nothing) Then
                If (temparray.Length > 0) Then
                    ' Iterate through a collection
                    For Each item As Object In temparray
                        If Not (item Is Nothing) Then
                            itemsAreNull = False
                            Exit For
                        End If
                    Next item
                End If
            End If
            If (itemsAreNull = True) Then
                Dim sorry As String = "no"
                Session("redu") = sorry
            End If
            UIN = DBGetField(rs, "UIN")
            PIDM = DBGetField(rs, "PIDM")
            If CWIDT.Text = UIN Then
                Session("CWID") = Me.CWIDT.Text.Trim
                fname = DBGetField(rs, "FIRSTNAME")
                lname = DBGetField(rs, "LASTNAME")
                Session("FIRSTNAME") = fname
                Session("LASTNAME") = lname
                msg.Text = "UIN is incorrect"
            End If
        End While
        rs = DBRecordSetDestroy(rs)
        Call localDBConnectionClose()
    End Sub
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 33 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 33 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros