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
Mike abban
NA
10
25.9k
populate checkedlistbox from db and mark some as checked
May 7 2014 5:02 AM
I have a windows form which loads all data from a table (tblMinistries) and displays it in a checklistbox. This work works correctly, now i have another table (tblNewministries) and i want all the items in the table (tblNewministries) to be checked automaticaly in the checkedlistbox when it is populated. table (tblNewministries) is a subset of table (tblMinistries)
Please help me out
code for populating the checkedlistbox
public void PopuMinistry()
{
SqlConnection conn = new SqlConnection("Data Source=USER-PC;Initial Catalog=PIWCDB;User ID=sa;Password=mike");
if (conn.State != ConnectionState.Open)
{
conn.Open();
}
string SqlDataPull = ("select Homecellname from tblministries order by Homecellname");
SqlCommand cmd = new SqlCommand(SqlDataPull);
cmd.Connection = conn;
cmd.CommandType = CommandType.Text;
SqlDataReader dr = cmd.ExecuteReader();
while (dr.Read())
{
SqlDataPull = dr[0].ToString();
cblMinistries.Items.Add(SqlDataPull);
}
dr.Close();
}
Reply
Answers (
0
)
Regular Expression required
Is it possible to create a new object of a class with other