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
James Dsouza
NA
5
1.2k
Does not iterate through datarow
Jun 21 2014 12:28 PM
Hi, i get this error where it does not iterate through datarow row and control passes to the end of the program.? The sql fetches only one row, i have this code on page load as well and it works fine there as there are multiple records. thanks..
cmd6 = new SqlCommand("select * from daysavailable where Doc_Id=@Id", sqlconnect);
// cmd6.CommandType = CommandType.StoredProcedure;
cmd6.Parameters.Add(new SqlParameter("@Id", textBox1.Text));
datareadr6 = cmd6.ExecuteReader();
if (datareadr6.Read())
{
dt3.Clear();
dt3.Load(datareadr6);
MessageBox.Show(dt3.Rows.Count.ToString());
if(dt3.Rows.Count > 0)
{
foreach (DataRow row in dt3.Rows)
{
for (int j = 0; j < checkedListBox1.Items.Count; j++)
{
string str2 = row.ItemArray[j + 1].ToString();
if (str2 == "y")
{
checkedListBox1.SetItemCheckState(j, CheckState.Checked);
}
else
{
checkedListBox1.SetItemCheckState(j, CheckState.Unchecked);
}
}
}
}
}
Reply
Answers (
5
)
How to transfer data from one datagridview to another
Partial class