lnshop
asked on
System.Data.DataRowView in DropDownList Box
I am having trouble populating my dropdown list box with data from a database. The control code is below. It is displaying System.Data.DataRowView 8 times which is the correct number of rows to return. Can someone please advise what I have done wrong. I am using windows XP and Foxpro 6.0 Thank you for your assistance.
<asp:DropDownList ID="ddlCasPolicyTypeOption s" DataTextField="policy_typ" DataValueField="policy_typ " runat="server">
</asp:DropDownList>
<asp:DropDownList ID="ddlCasPolicyTypeOption
</asp:DropDownList>
VB 2005 Code
Dim CasPolicyType As New OdbcCommand(strCasualtyPolicyType, connCasPolicyType)
CasPolicyType.CommandText = "SELECT DISTINCT trim(cas_request.policy_typ) " & _
"FROM cas_request " & _
"where cas_request.Policy_typ<>"""" ORDER BY cas_Request.policy_typ ASC"
Dim CasPolicyTypeDataAdapter As New Odbc.OdbcDataAdapter
Dim CasPolicyTypeDataView As DataView
Dim CasPolicyTypeDataSet As New DataSet
CasPolicyTypeDataAdapter = New OdbcDataAdapter(strCasualtyPolicyType, connCasPolicyType)
CasPolicyTypeDataAdapter.Fill(CasPolicyTypeDataSet, "cas_request")
CasPolicyTypeDataView = CasPolicyTypeDataSet.Tables("cas_request").DefaultView
ddlCasPolicyType.DataSource = CasPolicyTypeDataView
ddlCasPolicyType.DataBind()
ASKER
This is the error message I am getting. I have checked the table several times and there is a field named policy_typ.
'System.Data.DataRowView' does not contain a property with the name 'policy_typ'.
Thank you for your assistance.
'System.Data.DataRowView' does not contain a property with the name 'policy_typ'.
Thank you for your assistance.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
It worked, thanks so much for your help.
ddlCasPolicyType.DataSourc
ddlCasPolicyType.DataTextF
ddlCasPolicyType.DataValue
ddlCasPolicyType.DataBind(
Wayne