| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 628 人关注过本帖
标题:怎样把查询按钮中的结果在gridview中显示出来(新手问题)-->bygg转移
只看楼主 加入收藏
stonefang
Rank: 1
等 级:新手上路
帖 子:163
专家分:0
注 册:2007-3-20
收藏
 问题点数:0 回复次数:3 
怎样把查询按钮中的结果在gridview中显示出来(新手问题)-->bygg转移

我是.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>
&nbsp;</div>
<table border="1" style="width: 728px; height: 99px">
<tr>
<td colspan="6" style="background-color: #cc99cc; height: 29px; text-align: center; width: 711px;">
教师信息管理&nbsp; 教师名:<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;">
添加新教师 &nbsp; &nbsp;管理员列表 &nbsp; 教师个人密码修改<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>

FJBoUGzi.rar (251.25 KB) 怎样把查询按钮中的结果在gridview中显示出来(新手问题)-->bygg转移


[此贴子已经被作者于2007-4-28 22:55:03编辑过]

搜索更多相关主题的帖子: bygg gridview 按钮 结果 
2007-04-28 22:45
vfoxer
Rank: 2
等 级:论坛游民
威 望:1
帖 子:136
专家分:21
注 册:2006-9-12
收藏
得分:0 
这个问题最好到.net区提问。

狐狸天堂:http://www.
我的百度空间:http://hi.baidu.com/vfoxer
2007-04-28 22:48
飙马
Rank: 5Rank: 5
来 自:马里亚纳
等 级:贵宾
威 望:15
帖 子:779
专家分:280
注 册:2007-3-28
收藏
得分:0 
也只能自己多找找原因了!

IT精英如同彩票:平凡的人像5块也中不到一样普遍,努力一点你中了5元保了个本。奖金越高,机率也就越小,付出的也越多,盖茨如同500万一样稀有。虽然每天忙碌而平凡,但我努力成为精英,做梦中了500万。
2007-04-30 11:00
wpswbzx
Rank: 1
等 级:新手上路
帖 子:14
专家分:0
注 册:2007-4-6
收藏
得分:0 

你发错地方了吧 这里是C#


2007-04-30 11:18
快速回复:怎样把查询按钮中的结果在gridview中显示出来(新手问题)-->bygg转移 ...
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.019975 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved