我正在 asp.net 中制作课程注册系统。现在我正在建立一个页面,显示学生的成绩单,即他/她所学的所有课程。为此,我使用两个表:保存所有课程记录的课程表和保存所有注册记录的注册表。我单击一个名为 lbShowTranscript 的链接按钮,它将我重定向到 StudenGetTranscript 页面。我在那个新重定向的页面中有一个 gridview 来显示成绩单,但它没有给出任何结果,它总是空的。这是代码:
public partial class StudentGetTranscript : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
int getid = MyGlobals.student.getID();
}
}
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
DataKeyNames="CourseCode,CourseNumber,Term,StudentID"
DataSourceID="SqlDataSource1">
<Columns>
<asp:BoundField DataField="CourseCode" HeaderText="CourseCode" ReadOnly="True"
SortExpression="CourseCode" />
<asp:BoundField DataField="CourseNumber" HeaderText="CourseNumber"
ReadOnly="True" SortExpression="CourseNumber" />
<asp:BoundField DataField="Term" HeaderText="Term" ReadOnly="True"
SortExpression="Term" />
<asp:BoundField DataField="StudentID" HeaderText="StudentID" ReadOnly="True"
SortExpression="StudentID" />
<asp:BoundField DataField="Grade" HeaderText="Grade" SortExpression="Grade" />
<asp:BoundField DataField="CourseName" HeaderText="CourseName"
SortExpression="CourseName" />
<asp:BoundField DataField="CRN" HeaderText="CRN" SortExpression="CRN" />
<asp:BoundField DataField="Credit" HeaderText="Credit"
SortExpression="Credit" />
</Columns>
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
SelectCommand="SELECT RegisterTable.CourseCode, RegisterTable.CourseNumber, RegisterTable.Term, RegisterTable.StudentID, RegisterTable.Grade, CourseTable.CourseName, CourseTable.CRN, CourseTable.Credit FROM RegisterTable INNER JOIN CourseTable ON RegisterTable.CourseCode = CourseTable.CourseCode WHERE (RegisterTable.StudentID = @getid)">
<SelectParameters>
<asp:Parameter Name="getid" />
</SelectParameters>
</asp:SqlDataSource>
谁能帮我这个?谢谢