Re: Binding data to a DropDownList
From: Marina (someone_at_nospam.com)
Date: 03/08/04
- Next message: Maziar Aflatoun: "Windows 2000 Active Directory"
- Previous message: Curt_C [MVP]: "Re: Default.aspx - newbie Q`"
- In reply to: Steven K: "Binding data to a DropDownList"
- Next in thread: Chris Taylor: "Re: Binding data to a DropDownList"
- Messages sorted by: [ date ] [ thread ]
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
>
>
- Next message: Maziar Aflatoun: "Windows 2000 Active Directory"
- Previous message: Curt_C [MVP]: "Re: Default.aspx - newbie Q`"
- In reply to: Steven K: "Binding data to a DropDownList"
- Next in thread: Chris Taylor: "Re: Binding data to a DropDownList"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|