我是.NET的初学者,在做学生管理系统的教师管理时,遇到的问题是不会做查询,请高手们帮忙解决一下,先谢了,下面是页面的代码.压缩包里是全部内容.
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="St_teacher.aspx.cs" Inherits="St_teacher" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<link href="../SiteMap/body.css" rel="stylesheet" type="text/css"/>
<title>教师信息管理</title>
</head>
<body alink="#66ccff" bgcolor="#ccccff" link="blue" text="black" vlink="#cc6600" style="text-align: center">
<form id="form1" runat="server">
<div>
</div>
<table border="1" style="width: 728px; height: 99px">
<tr>
<td colspan="6" style="background-color: #cc99cc; height: 29px; text-align: center; width: 711px;">
教师信息管理 教师名:<asp:TextBox ID="st_tbx_tname" runat="server"></asp:TextBox>教师编号:<asp:TextBox
ID="st_tbx_tid" runat="server"></asp:TextBox>
<asp:Button ID="st_btn_search" runat="server" Text="查询" OnClick="st_btn_search_Click" /></td>
</tr>
<tr>
<td style="background-color: #cc99cc; width: 711px; text-align: center;" colspan="6" rowspan="2">
<asp:GridView ID="gridv_t" runat="server" AllowPaging="True" AllowSorting="True"
AutoGenerateColumns="False" DataKeyNames="ST_Teacher_id" DataSourceID="SqlDS_t"
Height="100%" Width="100%" BackColor="White" BorderColor="#CCCCCC" BorderStyle="None" BorderWidth="1px" CellPadding="3">
<Columns>
<asp:BoundField DataField="ST_Teacher_id" HeaderText="教师号" ReadOnly="True" SortExpression="ST_Teacher_id" />
<asp:BoundField DataField="ST_Teacher_name" HeaderText="教师姓名" SortExpression="ST_Teacher_name" />
<asp:BoundField DataField="ST_Teacher_college" HeaderText="学院" SortExpression="ST_Teacher_college" />
<asp:HyperLinkField HeaderText="加为管理员" DataTextField="ST_Teacher_id" />
<asp:CommandField ShowDeleteButton="True" ShowEditButton="True" />
</Columns>
<FooterStyle BackColor="White" ForeColor="#000066" />
<RowStyle ForeColor="#000066" />
<SelectedRowStyle BackColor="#669999" Font-Bold="True" ForeColor="White" />
<PagerStyle BackColor="White" ForeColor="#000066" HorizontalAlign="Left" />
<HeaderStyle BackColor="#006699" Font-Bold="True" ForeColor="White" />
</asp:GridView>
<br />
<asp:SqlDataSource ID="SqlDS_t" runat="server" ConflictDetection="CompareAllValues"
ConnectionString="<%$ ConnectionStrings:st_dbconn %>" DeleteCommand="DELETE FROM [ST_teacher] WHERE [ST_Teacher_id] = @original_ST_Teacher_id AND [ST_Teacher_name] = @original_ST_Teacher_name AND [ST_Teacher_college] = @original_ST_Teacher_college"
InsertCommand="INSERT INTO [ST_teacher] ([ST_Teacher_id], [ST_Teacher_name], [ST_Teacher_college]) VALUES (@ST_Teacher_id, @ST_Teacher_name, @ST_Teacher_college)"
OldValuesParameterFormatString="original_{0}" SelectCommand="SELECT * FROM [ST_teacher] ORDER BY [ST_Teacher_id], [ST_Teacher_name] DESC"
UpdateCommand="UPDATE [ST_teacher] SET [ST_Teacher_name] = @ST_Teacher_name, [ST_Teacher_college] = @ST_Teacher_college WHERE [ST_Teacher_id] = @original_ST_Teacher_id AND [ST_Teacher_name] = @original_ST_Teacher_name AND [ST_Teacher_college] = @original_ST_Teacher_college">
<DeleteParameters>
<asp:Parameter Name="original_ST_Teacher_id" Type="String" />
<asp:Parameter Name="original_ST_Teacher_name" Type="String" />
<asp:Parameter Name="original_ST_Teacher_college" Type="String" />
</DeleteParameters>
<UpdateParameters>
<asp:Parameter Name="ST_Teacher_name" Type="String" />
<asp:Parameter Name="ST_Teacher_college" Type="String" />
<asp:Parameter Name="original_ST_Teacher_id" Type="String" />
<asp:Parameter Name="original_ST_Teacher_name" Type="String" />
<asp:Parameter Name="original_ST_Teacher_college" Type="String" />
</UpdateParameters>
<InsertParameters>
<asp:Parameter Name="ST_Teacher_id" Type="String" />
<asp:Parameter Name="ST_Teacher_name" Type="String" />
<asp:Parameter Name="ST_Teacher_college" Type="String" />
</InsertParameters>
</asp:SqlDataSource>
</td>
</tr>
<tr>
</tr>
<tr>
<td colspan="6" style="height: 23px; background-color: #cc99cc; text-align: center; width: 711px;">
添加新教师 管理员列表 教师个人密码修改<br />
<asp:Button ID="st_btn_exit" runat="server" Text="退出" OnClick="st_btn_exit_Click" />
<asp:Label ID="st_lab_teach" runat="server" Text="Label_tea" Visible="False"></asp:Label></td>
</tr>
</table>
</form>
</body>
</html>