应该是想返回当前登录学生所选的课程吧
可以把sql改成select cou.* from Course cou where exist (select 1 from SelectCourse scou where Stuid='" + Session["UserName"].ToString() + "' and cou.CourseID=scou.CourseID)
或者
select cou.*
from Course cou
Inner join SelectCourse scou on cou.CourseID=scou.CourseID
where scou.Stuid='" + Session["UserName"].ToString() + "'
返回的就是该生所选的课程了
再用datasource,databind把它绑定到gridview