Hi Guys
I have a similer code which works on button click event and not working while Accessing data through data reader ?what would be the mistake ?
thanks
regards
sumith
---Database Part
private void PopScheduleByID()
{
using (SqlConnection con = new SqlConnection(CS))
{
SqlCommand cmd = new SqlCommand("select* from ClassSchedule where Schedule_id=@Schedule_id", con);
cmd.Parameters.AddWithValue("@Schedule_id", txtschid.Text);
con.Open();
SqlDataReader DR = cmd.ExecuteReader();
while (DR.Read())
{
txtschid.Text = DR["Schedule_id"].ToString();
txtcourseid.Text = DR["CourseID"].ToString();
string Selectedday = DR[2].ToString();
int y = cboweekdays.FindStringExact(DR["Day"].ToString());
cboweekdays.SelectedIndex = y;
mskstarttime.Text = DR["StartTime"].ToString();
mskendtime.Text = DR["EndTime"].ToString();
}
}
}
---Button Click event
private void button1_Click(object sender, EventArgs e)
{
int x=cboweekdays.FindStringExact("SATURDAY");
cboweekdays.SelectedIndex = x;
}