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
narasiman rao
NA
519
771.6k
I tried several times in combobox data is not retrieved DB
Aug 13 2015 10:39 PM
My code as follows
In pageload i written the below code as follows
SqlConnection conn = new SqlConnection(@"Data Source=DOCTOR\SQLEXPRESS;Initial Catalog=Testing;User ID=sa;Password=a");
conn.Open();
SqlCommand sc = new SqlCommand("select Designation from Designations where active <> 'd'", conn);
SqlDataReader reader;
reader = sc.ExecuteReader();
DataTable dt = new DataTable();
dt.Columns.Add("Designation", typeof(string));
dt.Load(reader);
dt.Load(reader);
ComboBox1.DataTextField = "Designation";
ComboBox1.DataValueField = "Designation";
ComboBox1.DataSource = dt;
ComboBox1.DataBind();
conn.Close();
In database records as follows (Table name Designations )
ID Name Designation
1 Raj Course Officer
2 Ramesh Authorised signatoury
In run mode as follows
Designation Combobox
But in combobox designation is not displayed.
i tried several time but in combobox designation is not shown.
please help me what is the problem in my above code.
Reply
Answers (
2
)
.NET
C# winform Desktop application to Track the PHP live Website