Monday, March 26, 2012

Loop Through a recordset

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

--
Thanks in advance,

Steventry 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()

------

"Steven K" <skaper@.troop.com> wrote in message
news:OsMcBfXAEHA.2308@.tk2msftngp13.phx.gbl...
> 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
> --
> Thanks in advance,
> Steven

0 comments:

Post a Comment