11
Reply

Tell me where i am wrong

Monica Priyadharshini

Monica Priyadharshini

Sep 19 2017 9:55 AM
353
An exception of type 'System.FormatException' occurred in mscorlib.dll but was not handled in user code
 
Additional information: Input string was not in a correct format. 
  1. /DATA ACCESS LAYER  
  2.   
  3. public DataSet StdCourseBindDAL(int Uid)  
  4. {  
  5. SqlConnection con = new SqlConnection(constring);  
  6. con.Open();  
  7. SqlCommand cmd = new SqlCommand("spGetRegCourses", con);  
  8. cmd.CommandType = CommandType.StoredProcedure;  
  9. SqlDataAdapter sqlda = new SqlDataAdapter(cmd);  
  10. cmd.Parameters.Add(new SqlParameter("@UserID", Uid));  
  11. DataSet ds = new DataSet();  
  12. sqlda.Fill(ds);  
  13. return ds;  
  14. }  
  15.   
  16. /BLL  
  17. public DataSet StdCourseRegBindBLL(int Uid)  
  18. {  
  19. return da.StdCourseBindDAL(Uid);  
  20. }  
  21.   
  22. /code behind  
  23. protected void Page_Load(object sender, EventArgs e)  
  24. {  
  25. DataSet StudentDetails = new DataSet();  
  26. string UName = Session["username"].ToString();  
  27. StudentDetails = sbl.GetStudentDetailInLable(UName);  
  28. LblS_ID.Text = StudentDetails.Tables[0].Rows[0]["StudentID"].ToString() + "";  
  29. LblS_Name.Text = StudentDetails.Tables[0].Rows[0]["StudentName"].ToString() + "";  
  30. LblS_eMailID.Text = StudentDetails.Tables[0].Rows[0]["EmailID"].ToString() + "";  
  31. LblPhnNum.Text = StudentDetails.Tables[0].Rows[0]["PhnNo"].ToString() + "";  
  32. LblS_City.Text = StudentDetails.Tables[0].Rows[0]["city"].ToString() + "  
  33. ";  
  34. }  
  35. public void GridBindCourseStdReg(int ID)  
  36. {  
  37. DataSet bda = sbl.StdCourseRegBindBLL(ID);  
  38. GrdCourseStdReg.DataSource = bda;  
  39. GrdCourseStdReg.DataBind();  
  40. }  
  41. protected void BtnCompCourses_Click(object sender, EventArgs e)  
  42. {  
  43. int UID;  
  44. UID =Convert.ToInt32(LblS_ID.Text);  
  45. GridBindCourseStdReg(UID);  
  46. } 

Answers (11)