Loop Through a recordset

S

Steven K

Hello,

I am trying to get data from a stored procedure and then loop through that
recordset to fill a ListBox (ASP code). However, I am getting the error:
'EOF' is not a member of 'System.Data.OleDb.OleDbDataAdapter'.

Any help with this wold be appreciated.

'Populate the BusinessUnit combo box
'-----------------------------------
Dim spBusinessUnit As OleDbDataAdapter, strBusinessUnitBox As String
spBusinessUnit = New OleDbDataAdapter("sp_web_Search " &
"'FindBusinessProduct','','',''", cnnSearch)
spSearch.SelectCommand.CommandType = CommandType.StoredProcedure

Do While not spBusinessUnit.EOF
strListBox = spBusinessUnit("BusinessProduct_ID")
strBusinessUnitBox = strBusinessUnitBox & "<option value=" & strQuote &
strListBox & strQuote & ">" & strListBox & "</option>"
spBusinessUnit.MoveNext
Loop
 
K

Kirk Graves

try it like this..

----------------------------
Dim spBusinessUnit As OleDb.OleDbDataReader, strBusinessUnitBox As String
Dim cmd As New OleDb.OleDbCommand("sp_web_Search " & _
"'FindBusinessProduct','','',''", cnnSearch)
cmd.CommandType = CommandType.StoredProcedure

spBusinessUnit = cmd.ExecuteReader()
Do While spBusinessUnit.Read
strListBox = spBusinessUnit("BusinessProduct_ID")
strBusinessUnitBox = strBusinessUnitBox & "<option value=" & strQuote
& strListBox & strQuote & ">" _
& strListBox & "</option>"
Loop
spBusinessUnit.Close()
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top