I have one page on which there are 6 labels and six text box for subject apart from this there are 2 to 3 other text box and label for studnt information. i want to do in such a way that if i enter student enroll no i get his/her name ,dept,sem,all subjects on 6 labels and marks related to subject in text box.
In table there are fields
Marks_Entry
Student_Enroll Student_Name Sem Program subject Marks
1 sss 1 BCA Basic Communication Skills 75
1 sss 1 BCA Mathematical Foundation 85
1 sss 1 BCA Digital Computer Architecture 88
1 sss 1 BCA Programming concepts & Algorithms 97
1 sss 1 BCA Introduction to Database 55
1 sss 1 BCA Introduction to PC Software 74
now when i am entering roll no in form then student name ,program, sem is fetched but in label 1 to label 6 same subject name that is 1st subject name is copied and in text box also first marks are fetched in all textboxes
my c# code on student enroll textbox is this
protected void txtEnroll_TextChanged1(object sender, EventArgs e)
{
conn.Open();
qry = "SELECT * FROM Marks_Entry WHERE Student_Enroll_No = '" + txtEnroll.Text + "'";
SqlCommand cmd = new SqlCommand(qry, conn);
SqlDataReader dr = cmd.ExecuteReader();
//DataSet ds = new DataSet();
if (dr.Read() == true)
{
txtname.Text = dr.GetValue(4).ToString();
txtprog.Text = dr.GetValue(5).ToString();
txtSem.Text = dr.GetValue(1).ToString();
lbl1.Text = dr.GetValue(2).ToString();
lbl2.Text = dr.GetValue(2).ToString();
lbl3.Text = dr.GetValue(2).ToString();
lbl4.Text = dr.GetValue(2).ToString();
lbl5.Text = dr.GetValue(2).ToString();
lbl6.Text = dr.GetValue(2).ToString();
txt1.Text = dr[6].ToString();
txt2.Text = dr[6].ToString();
txt3.Text = dr[6].ToString();
txt4.Text = dr[6].ToString();
txt5.Text = dr[6].ToString();
txt6.Text = dr[6].ToString();
}
dr.Close();
conn.Close();
}
plz help me in this how can i get different values? from database