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="ddlCasPolicyTypeOptions"  DataTextField="policy_typ" DataValueField="policy_typ" runat="server">
                            </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()

Open in new window

lnshopAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Wayne Taylor (webtubbs)Commented:
You will also need to set the DataTextField and DataValueField properties of the DropDownList....

            ddlCasPolicyType.DataSource = CasPolicyTypeDataView
            ddlCasPolicyType.DataTextField = "policy_typ"
            ddlCasPolicyType.DataValueField = "policy_typ"
            ddlCasPolicyType.DataBind()

Wayne
0
lnshopAuthor Commented:
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.
0
Wayne Taylor (webtubbs)Commented:
Set the DataSource to the DataTable instead....

            ddlCasPolicyType.DataSource = CasPolicyTypeDataSet.Tables("cas_request")
            ddlCasPolicyType.DataTextField = "policy_typ"
            ddlCasPolicyType.DataValueField = "policy_typ"
            ddlCasPolicyType.DataBind()

Wayne
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
lnshopAuthor Commented:
It worked, thanks so much for your help.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.