Populating a dropdown control

I

Irishmaninusa

I am trying to populate a drop down on a form with the contents of a
recordset and I am getting the following values in the dropdown

System.Data.DataRowView and not the expected content that should be
appearing in there. I have stepped through the code in debug mode and
examine the value of the recordset, and the right values seem to be there.

Any idea what is causing this and how to fix it so that it does not show up
like this?





..ResetParameters()

..AddParameter("iMRN", OleDb.OleDbType.Integer, ParameterDirection.Input,
ctlHeader.PatientData("PatientMRN"))

'Pull back the list of encounters for the selected patient

If .Execute(.genuSql.StoreProcSelect, "selPatient_Billing") Then

Dim oRow As DataRow

oData = .DbData_DataTable



If .DbData_DataTable.Rows.Count > 0 Then

With drpEnc

..DataSource = oData

..DataBind()

..DataValueField = "id"

..DataTextField = "DateOfService"

End With

End If

Else

Throw New Exception(.ErrorMessage)

End If 'Encounter List


--
J.Daly
structure:interactive
Ph: 616-364-7423
Fx: 616-364-6941

http://www.structureinteractive.com
 
K

Karl

Se the DataText and DataVauleField properties BEFORE the DataBind().

DataBind() binds your source to your control, setting what to bind after
doesn't work :)

Karl

"Irishmaninusa"
 
I

Irishmaninusa

I thought I had did that before and it still didn't work, but I tried it
again and this time it work. Now I have different issue, the stored
procedure I call pulls back date values in order, where the most recent date
is at the top and it goes back in order.

7/28/2004
7/1/2004
6/30/2004

This is the where the stored procedure pulls back the dates, which is
correct. However in the drop down it is being displayed as


7/28/2004
6/30/2004
7/1/2004

Why would this be like this?
 
K

Karl

I honestly don't know. I can see that you are using OLEdbClient which I'm
no expert at. Are these Date fields or string/varchar fields? you may want
to start a new thread asking this question and identifying the
database/query/schema so that someone better suited will help.

Karl

"Irishmaninusa"
 
I

Irishmaninusa

Thanks Karl, I will see what turns up. Thank you for your help to my earlier
issue.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,773
Messages
2,569,594
Members
45,124
Latest member
JuniorPell
Top