Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help needed with Array from RecordSet

Status
Not open for further replies.

SuperCyber

Programmer
Aug 10, 2001
35
US
After driving myself crazy I have come up with the code below to put a recordset into an array. It produces the required result but I know that there has got to be an easier way to do this. Any help is very appreciated.

Brian

Function FncEmpList()
Dim rs
Set cmdListEmp = Server.CreateObject("ADODB.Command")
With cmdListEmp
.ActiveConnection = connAPS
.CommandText = "sproc_CalListEmp"
.CommandType = adCmdStoredProc
Set rs = .Execute
End With
Set cmdListEmp = nothing
Do While NOT rs.EOF
FncEmpList = FncEmpList & rs("empLastName") & "," ' Return the data as an Array
rs.MoveNext
Loop
rs.Close
Set rs = Nothing
End Function

Dim i,empID,empName,aryParsed,strItm
aryParsed = Split(FncEmpList, ",")
For i = 0 to Ubound(aryParsed)-1
strItm = aryParsed(i)
Response.Write &quot;strItm = <B>&quot; & strItm & &quot;</B><BR>&quot;
Next
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top