473,587 Members | 2,463 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Populating a dropdown control

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.Dat aRowView 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?

..ResetParamete rs()

..AddParameter( "iMRN", OleDb.OleDbType .Integer, ParameterDirect ion.Input,
ctlHeader.Patie ntData("Patient MRN"))

'Pull back the list of encounters for the selected patient

If .Execute(.genuS ql.StoreProcSel ect, "selPatient_Bil ling") Then

Dim oRow As DataRow

oData = .DbData_DataTab le

If .DbData_DataTab le.Rows.Count > 0 Then

With drpEnc

..DataSource = oData

..DataBind()

..DataValueFiel d = "id"

..DataTextField = "DateOfServ ice"

End With

End If

Else

Throw New Exception(.Erro rMessage)

End If 'Encounter List
--
J.Daly
structure:inter active
Ph: 616-364-7423
Fx: 616-364-6941

http://www.structureinteractive.com

Nov 18 '05 #1
4 1343
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

"Irishmanin usa"
<jd***@structuc tureinteractive .com.takemeoffi fyouwantoemailm e> wrote in
message news:u3******** ******@TK2MSFTN GP12.phx.gbl...
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.Dat aRowView 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?

.ResetParameter s()

.AddParameter(" iMRN", OleDb.OleDbType .Integer, ParameterDirect ion.Input,
ctlHeader.Patie ntData("Patient MRN"))

'Pull back the list of encounters for the selected patient

If .Execute(.genuS ql.StoreProcSel ect, "selPatient_Bil ling") Then

Dim oRow As DataRow

oData = .DbData_DataTab le

If .DbData_DataTab le.Rows.Count > 0 Then

With drpEnc

.DataSource = oData

.DataBind()

.DataValueField = "id"

.DataTextField = "DateOfServ ice"

End With

End If

Else

Throw New Exception(.Erro rMessage)

End If 'Encounter List
--
J.Daly
structure:inter active
Ph: 616-364-7423
Fx: 616-364-6941

http://www.structureinteractive.com

Nov 18 '05 #2
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?

"Karl" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net> wrote in
message news:Oz******** *****@TK2MSFTNG P12.phx.gbl...
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

"Irishmanin usa"
<jd***@structuc tureinteractive .com.takemeoffi fyouwantoemailm e> wrote in
message news:u3******** ******@TK2MSFTN GP12.phx.gbl...
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.Dat aRowView 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?

.ResetParameter s()

.AddParameter(" iMRN", OleDb.OleDbType .Integer, ParameterDirect ion.Input,
ctlHeader.Patie ntData("Patient MRN"))

'Pull back the list of encounters for the selected patient

If .Execute(.genuS ql.StoreProcSel ect, "selPatient_Bil ling") Then

Dim oRow As DataRow

oData = .DbData_DataTab le

If .DbData_DataTab le.Rows.Count > 0 Then

With drpEnc

.DataSource = oData

.DataBind()

.DataValueField = "id"

.DataTextField = "DateOfServ ice"

End With

End If

Else

Throw New Exception(.Erro rMessage)

End If 'Encounter List
--
J.Daly
structure:inter active
Ph: 616-364-7423
Fx: 616-364-6941

http://www.structureinteractive.com


Nov 18 '05 #3
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

"Irishmanin usa"
<jd***@structuc tureinteractive .com.takemeoffi fyouwantoemailm e> wrote in
message news:e2******** *****@TK2MSFTNG P11.phx.gbl...
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?

"Karl" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net> wrote in
message news:Oz******** *****@TK2MSFTNG P12.phx.gbl...
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

"Irishmanin usa"
<jd***@structuc tureinteractive .com.takemeoffi fyouwantoemailm e> wrote in
message news:u3******** ******@TK2MSFTN GP12.phx.gbl...
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.Dat aRowView 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?

.ResetParameter s()

.AddParameter(" iMRN", OleDb.OleDbType .Integer,

ParameterDirect ion.Input, ctlHeader.Patie ntData("Patient MRN"))

'Pull back the list of encounters for the selected patient

If .Execute(.genuS ql.StoreProcSel ect, "selPatient_Bil ling") Then

Dim oRow As DataRow

oData = .DbData_DataTab le

If .DbData_DataTab le.Rows.Count > 0 Then

With drpEnc

.DataSource = oData

.DataBind()

.DataValueField = "id"

.DataTextField = "DateOfServ ice"

End With

End If

Else

Throw New Exception(.Erro rMessage)

End If 'Encounter List
--
J.Daly
structure:inter active
Ph: 616-364-7423
Fx: 616-364-6941

http://www.structureinteractive.com



Nov 18 '05 #4
Thanks Karl, I will see what turns up. Thank you for your help to my earlier
issue.

"Karl" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net> wrote in
message news:um******** ******@TK2MSFTN GP11.phx.gbl...
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

"Irishmanin usa"
<jd***@structuc tureinteractive .com.takemeoffi fyouwantoemailm e> wrote in
message news:e2******** *****@TK2MSFTNG P11.phx.gbl...
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?

"Karl" <karl REMOVE @ REMOVE openmymind REMOVEMETOO . ANDME net> wrote in
message news:Oz******** *****@TK2MSFTNG P12.phx.gbl...
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

"Irishmanin usa"
<jd***@structuc tureinteractive .com.takemeoffi fyouwantoemailm e> wrote in message news:u3******** ******@TK2MSFTN GP12.phx.gbl...
> 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.Dat aRowView 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?
>
>
>
>
>
> .ResetParameter s()
>
> .AddParameter(" iMRN", OleDb.OleDbType .Integer, ParameterDirect ion.Input, > ctlHeader.Patie ntData("Patient MRN"))
>
> 'Pull back the list of encounters for the selected patient
>
> If .Execute(.genuS ql.StoreProcSel ect, "selPatient_Bil ling") Then
>
> Dim oRow As DataRow
>
> oData = .DbData_DataTab le
>
>
>
> If .DbData_DataTab le.Rows.Count > 0 Then
>
> With drpEnc
>
> .DataSource = oData
>
> .DataBind()
>
> .DataValueField = "id"
>
> .DataTextField = "DateOfServ ice"
>
> End With
>
> End If
>
> Else
>
> Throw New Exception(.Erro rMessage)
>
> End If 'Encounter List
>
>
> --
> J.Daly
> structure:inter active
> Ph: 616-364-7423
> Fx: 616-364-6941
>
> http://www.structureinteractive.com
>
>
>



Nov 18 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
2573
by: Lamine Darbouche | last post by:
Can anybody help? I need to have three list boxes automatically populating each other, (ie when region is selected from the first listbox, it will populate automatically the second one which is the TOWNS and when the town is selected is should populate the third one AREA) all data is in the database in one table. Any idea??? Many thanks in adavance. Lamine
13
2861
by: melih.onvural | last post by:
Group, I'm having a tough time understanding some of the previous posts on this topic so I wanted to write what I've tried and hope that you can help me troubleshoot. I have a dropdown populated from a table and I want to take that selection and use it to populate the next dropdown. So far: 1) I tried using a query that said select specificissue from specific_issue and used as my criterion !!
3
4063
by: to_rgoyal | last post by:
Hi All, I am creating one web base application using ASP.net and C#. I am populating dropdown lists of my web pages using database. I am using this code: con = new SqlConnection(connectionString); SqlCommand getresult = new SqlCommand("select distinct(owner) from issue_log",con); con.Open();
6
2257
by: Casey | last post by:
hello, I need to populate a drop down list when the user clicks on the arrow button. how do i do this. Should i use a html select control or is it possible using the asp:dropdownlist
1
1895
by: Patrick.O.Ige | last post by:
Doing the simple DropDown List binding using the method NextResult() But its just not populating .. what am i missing Its populating the 3 DropDwonList but no Data? Private Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) If Not IsPostBack Then Dim sqlConnection As SqlConnection = New SqlConnection sqlConnection.ConnectionString =
1
1194
by: asad | last post by:
Hello, i want to populate the drop down box values based on the first drop down box value, actually i have form in which user will select a car maker and based on that value below 2 drop down box values will be populated For example user select Suzuki and based on that value in one drop down car models will be shown and in secound one car type will be shown, how can i do it in ASP.NET, please tell me, i'm using MS-Access DB. Thanks.
1
1765
by: Mike P | last post by:
I am populating a drop down column in a datagrid on page load. Here is my code : <asp:TemplateColumn> <ItemTemplate> <asp:DropDownList ID="ddlUserName" Font-Name="Verdana" Font-Size="8pt" Runat=server DataValueField="UserName" DataTextField="UserName" DataSource='<%# GetUserList() %>'>
2
1497
by: mamun | last post by:
Hi All, The problem is as follows: I have a table from where I am getting consultant's name and populating the dropdown list control. But I want to populate the default one which I got it as a query string from the previous page. How can I do that? I do appreciate your help.
0
1683
by: koonda | last post by:
Hi all, I have a Project due after one week. It is a web service project. I have a Web Form which communicates to the web service and this web service communicates to the database. I have all my SQL statements in the Data Acess Layer to create more secure web service application. The Web service class is also in the Data Access Layer. I need to populates the 4 Dropdown list boxes on the web form from one table. I have Customer table which...
0
7924
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
7854
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8219
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
7978
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8221
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5395
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3882
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1455
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
1192
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.