473,385 Members | 1,569 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

About drop down list

Hi all,
i want to retrieve the values from database and edit them. I have drop down
list for gender. item :male and female.here is the code.
con.Open()

cmd = New SqlCommand("select * from customers where fullname='" & fname &
"'", con)

Dim dr As SqlDataReader

dr = cmd.ExecuteReader

While dr.Read

Me.txtName.Text = dr.Item("Fullname")

Me.txtAddress.Text = dr.Item("address")

Me.txtAreaCode.Text = dr.Item("areacode")

Me.txtTelePhone.Text = dr.Item("telephone")

Me.txtComments.Text = dr.Item("comments")

Me.txtEmail.Text = dr.Item("email")

Me.txtVisits.Text = dr.Item("novisits")

Me.ddlPrice.SelectedItem.Value = dr.Item("price")

Me.ddlGender.SelectedItem.Text = dr.Item("gender")

Me.ddlAntiVirus.SelectedItem.Text = dr.Item("antivirus")

Me.txtCity.Text = dr.Item("city")

Me.ddlstatus.SelectedItem.Text = dr.Item("status")

End While

con.Close()

but i am getting the error, i.e in gender drop down i could see female
,female. There is no male in list.So plz clarify this

regards

ravindra


May 20 '06 #1
2 922
can u paste the aspx page code also

"Ravindra" <ra******@nannacomputers.com> wrote in message
news:ud**************@TK2MSFTNGP04.phx.gbl...
Hi all,
i want to retrieve the values from database and edit them. I have drop
down list for gender. item :male and female.here is the code.
con.Open()

cmd = New SqlCommand("select * from customers where fullname='" & fname &
"'", con)

Dim dr As SqlDataReader

dr = cmd.ExecuteReader

While dr.Read

Me.txtName.Text = dr.Item("Fullname")

Me.txtAddress.Text = dr.Item("address")

Me.txtAreaCode.Text = dr.Item("areacode")

Me.txtTelePhone.Text = dr.Item("telephone")

Me.txtComments.Text = dr.Item("comments")

Me.txtEmail.Text = dr.Item("email")

Me.txtVisits.Text = dr.Item("novisits")

Me.ddlPrice.SelectedItem.Value = dr.Item("price")

Me.ddlGender.SelectedItem.Text = dr.Item("gender")

Me.ddlAntiVirus.SelectedItem.Text = dr.Item("antivirus")

Me.txtCity.Text = dr.Item("city")

Me.ddlstatus.SelectedItem.Text = dr.Item("status")

End While

con.Close()

but i am getting the error, i.e in gender drop down i could see female
,female. There is no male in list.So plz clarify this

regards

ravindra

May 20 '06 #2
"Ravindra" <ra******@nannacomputers.com> wrote in message
news:ud**************@TK2MSFTNGP04.phx.gbl...
Me.ddlGender.SelectedItem.Text = dr.Item("gender") but i am getting the error, i.e in gender drop down i could see female
,female. There is no male in list.So plz clarify this


That's because you are changing the visible text of the selected item in the
dropdown - you need to be using SelectedValue instead
May 20 '06 #3

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

Similar topics

2
by: Yoshitha | last post by:
hi I have 2 drop down lists in my application.1st list ontains itmes like java,jsp,swings,vb.net etc.2nd list contains percentage i.e it conatains the items like 50,60,70,80,90,100. i will...
5
by: Vigneshwar Pilli via DotNetMonster.com | last post by:
string connectionString1 = "server=(local); user=sa;password=sa; database=sonic"; System.Data.SqlClient.SqlConnection dbConnection1 = new System.Data.SqlClient.SqlConnection(connectionString1);...
1
by: pmelanso | last post by:
Hello, I have a drop down list which is dynatically loaded from a database and I have a second drop down list that is also dynatically loaded depending on what is selected in the first drop down...
8
by: rodchar | last post by:
hey all, i was wondering if this was worth doing or what implications might be. if i had a form that has 6 or more table lookups inside drop down lists would 6 custom controls be a lot of...
2
by: Dave A | last post by:
I am stuggling with databinding a drop down list, hooking into the SelectedIndexChanged and attempting to avoid using the viewstate. The drop down list is quite large so I would prefer to avoid...
8
by: Ed Dror | last post by:
Hi there ASP.NET 2.0 VB & SQL Express Lest take Northwind Categories Products as example I create a table that hold these two together and I create a stored procedure like select ProductID,...
5
by: ashok893 | last post by:
I'm using two drop down list ina form. I have generated the first drop down list from MySQL database. When i select an option from first drop down list, i have to generate second drop down list...
2
by: champ.supernova | last post by:
I have a repeater, which contains in its <HEADERTEMPLATEa drop-down list (set to autopostback). If the page is a postback, I want to modify the SQL of the repeater's datasource, DEPENDING ON the...
4
by: TycoonUK | last post by:
Hi, As I do not have IE7 on my computer, I was wondering if there is a fault in my CSS Menu when using IE7. Please can someone look at my site - http://www.worldofmonopoly.co.uk and tell me...
3
by: penny111 | last post by:
Hi there, For my application, i need to have 3 drop down lists 1. drop down list of folder names 2. drop down list of documents in the folder selected 3. drop down list of instances of the...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.