string strcom = "select  Student.StudentID, Name, CourseName,Mark " +
                               " from Result ,Elective ,CourseInfo,Student" +
                                "where  Elective.ElectiveID= Result.ElectiveID" +
                                "and Elective.CourseID=CourseInfo.CourseID" +
                                "and Student.StudentID = Elective.StudentID" +
                                "and Student.StudentID="+textID;
                DataSet ds = new DataSet();
              //  ds.Tables.Add("Result");
                SqlDataAdapter da = new SqlDataAdapter(strcom, conn);
                da.Fill(ds);
                dataGridView1.AutoGenerateColumns = true;
                dataGridView1.DataSource = ds;
                dataGridView1.DataMember = ds.Tables[0].DefaultView;