Re: Binding data to a DropDownList

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: Marina (someone_at_nospam.com)
Date: 03/08/04


Date: Mon, 8 Mar 2004 15:27:57 -0500

That is because you didn't set the text and value columns that should be
used for the text and value of the dropdown.

"Steven K" <skaper@troop.com> wrote in message
news:%23nMfcTUBEHA.628@TK2MSFTNGP10.phx.gbl...
> Hello,
>
> I am using the following to bind data from a stored procedure to a
> DropDownList. The problem I am having is that instead of getting the
data,
> I am getting the text "System.Data.Common.DbDataRecord" for every record,
> even though if I use a loop, I get the correct information.
>
>
> Dim spBusUnit As OleDb.OleDbDataReader
> Dim prmBusUnit As OleDbParameter
> Dim cmdBusUnit As New OleDb.OleDbCommand("sp_Search", cnnSearch)
>
> Data Binding
> -------------
> spBusUnit = cmdBusUnit.ExecuteReader()
> cboBusUnitBox.DataSource = spBusUnit
> cboBusUnitBox.DataBind()
> spBusUnit.Close() : spBusUnit = Nothing
>
> Looping through data
> ----------------------
> spBusUnit = cmdBusUnit.ExecuteReader()
> Do While spBusUnit.Read
> strListBox = spBusUnit("BusinessProduct_ID")
> strBusUnitBox = strBusUnitBox & "<option value=" & strQuote & strListBox &
> strQuote & ">" & strListBox & "</option>"
> Loop
> spBusUnit.Close() : spBusUnit = Nothing
>
> --
> Thanks in advance,
>
> Steven
>
>



Relevant Pages

  • Re: Binding data to a DropDownList
    ... used for the text and value of the dropdown. ... > even though if I use a loop, ... > Dim spBusUnit As OleDb.OleDbDataReader ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Binding data to a DropDownList
    ... the controls know which columns to bind for the text and values. ... > even though if I use a loop, ... > Dim spBusUnit As OleDb.OleDbDataReader ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Binding data to a DropDownList
    ... the controls know which columns to bind for the text and values. ... > even though if I use a loop, ... > Dim spBusUnit As OleDb.OleDbDataReader ...
    (microsoft.public.dotnet.framework.aspnet)