troubleshooting Question

loop through a sql recordset?

Avatar of jrddcd
jrddcd asked on
Visual Basic Classic
8 Comments1 Solution365 ViewsLast Modified:
i;'d like to make this more efficient perhaps by doing a loop?

all i want to do is go through every field in a recordset and assign a value to a variable in my vb script as long as the sql field is not empty.

here's what i've got, but i think it could be so much better - is there something like end of recordset or something for this?

    If SQLrs!EMP_CD <> "" Then
      EMPCode = SQLrs!EMP_CD
    End If

    If SQLrs!EMP_ACTIVE_FLG <> "" Then
     ActiveFlag = SQLrs!EMP_ACTIVE_FLG
    End If

    If SQLrs!EMP_TYPE <> "" Then
     EmpType = SQLrs!EMP_TYPE
    End If

    If SQLrs!EMP_FST_NM <> "" Then
     GivenName = SQLrs!EMP_FST_NM
    End If

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 8 Comments.
Start Free Trial
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 8 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