TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
israfel_e
NA
14
0
Dropdownlist problem
Mar 30 2005 5:38 PM
Hi everyone, Im sure you've heard this problem a million times but i sure could use some help. Im new to visual studio and C#. Im trying to implement a web form and everythings working fine except my bloody dropdownlist. I'm populating it from a Sql Server database and its populating fine, the information is there. The problem is no matter which option i select, it always gives the value of the first record from the table. I'm sure its the most ridiculous thing im missing but i can't seem to find it. My C# code is below, Id appreciate any response - Thanks private void Page_Load(object sender, System.EventArgs e) { sqlConnection1.Open(); SqlCommand cmd = new SqlCommand("Select * from course", sqlConnection1); SqlDataReader result = cmd.ExecuteReader(); ddlTest.DataSource = result; ddlTest.DataTextField = "FullName"; ddlTest.DataValueField = "Code"; ddlTest.DataBind(); result.Close(); } There are other text box's in the form that work fine. I dont want to waste time by including all the code, but basically the selection is then Inserted into a table. It inserts alright but only the first record of the table.
Reply
Answers (
5
)
string.LastIndexOf()
how to pass values from one form to another form...