- 1、本文档共4页,可阅读全部内容。
- 2、有哪些信誉好的足球投注网站(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
- 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
GridView加入自动求和求平均值小计
GridView加入自动求和求平均值小计
图:解决方案: private double sum 0;//取指定列的数据和,你要根据具体情况对待可能你要处理的是intprotected void GridView1_RowDataBound object sender, GridViewRowEventArgs e if e.Row.RowIndex 0 sum + Convert.ToDouble e.Row.Cells[6].Text ; else if e.Row.RowType DataControlRowType.Footer e.Row.Cells[5].Text 总薪水为:; e.Row.Cells[6].Text sum.ToString ; e.Row.Cells[3].Text 平均薪水为:; e.Row.Cells[4].Text int sum / GridView1.Rows.Count .ToString ; 后台全部代码:using System;using System.Data;using System.Configuration;using System.Web;using System.Web.Security;using System.Web.UI;using System.Web.UI.WebControls;using System.Web.UI.WebControls.WebParts;using System.Web.UI.HtmlControls;using System.Data.SqlClient;using System.Drawing;
public partial class Default7 : System.Web.UI.Page SqlConnection sqlcon; SqlCommand sqlcom; string strCon Data Source local ;Database 北风贸易;Uid sa;Pwd sa; protected void Page_Load object sender, EventArgs e if !IsPostBack bind ; protected void GridView1_RowEditing object sender, GridViewEditEventArgs e GridView1.EditIndex e.NewEditIndex; bind ; protected void GridView1_RowUpdating object sender, GridViewUpdateEventArgs e sqlcon new SqlConnection strCon ; string sqlstr update 飞狐工作室 set 姓名 + TextBox GridView1.Rows[e.RowIndex].Cells[1].Controls[0] .Text.ToString .Trim + ,家庭住址 + TextBox GridView1.Rows[e.RowIndex].Cells[3].Controls[0] .Text.ToString .Trim + where 身份证号码 + GridView1.DataKeys[e.RowIndex].Value.ToString + ; sqlcom new SqlCommand sqlstr, sqlcon ; sqlcon.Open ; sqlcom.ExecuteNonQuery ; sqlcon.Close ; GridView1.EditIndex -1; bind ; protected void GridView1_RowCancelingEdit object sender, GridViewCancelEditEventArgs e GridView1.EditIndex -1; bind ; public void bind string sqlstr select top 5 * from 飞狐工作室; sqlcon new SqlConnection strCon ; SqlDataAdapter myda new SqlDataAdapter sqlstr, sqlcon ; DataSet myds new DataSet ; sqlcon.Open ; myda.Fill myds, 飞狐工作室 ; GridView1.DataSource myd
您可能关注的文档
- 【精品】2011届高三英语二轮复习(鲁、津专用)精品考前特训 考前第27天.ppt
- 最全最实用地质年代表A3.doc
- Part One-Chapter5 -Double layer-Chen SL 14-15.ppt
- unit3金融英语.ppt
- 汉英笔译必备句型.pptx
- 古生物各论复习.doc
- 精读英语第三课PPT词汇解析.pptx
- 管理经济学讲义5.ppt
- 第二章 国际贸易的微观基础(一).ppt
- 地质年代表1(较新).doc
- 辽宁省沈阳市第一二六中学2022-2023学年八年级下学期期中考试数学试题(含答案).pdf
- 16.1《赤壁赋》课件(共29张PPT) 2024-2025学年统编版高中语文必修上册.pptx
- (2024)新课标一年级语文上册2 江南 第2课时 课件(共29张PPT).pptx
- 3开满鲜花的小路 课件(共23张PPT).pptx
- 2024年秋一年级上册第一单元 书写提示 日积月累 课件(共18张ppt).pptx
- (2024)新课标一年级语文上册 我上学了 第1课时 我是中国人 课件(共32张PPT).pptx
- (2024)新课标一年级语文上册 我上学了 第3课时 我是小学生 课件(共25张PPT).pptx
- 江苏省常州市金坛区直溪中学2023-2024学年九年级上学期期末专项训练一英语试卷(无答案).pdf
- 6-2《再别康桥》课件(共35张PPT) 统编版高中语文选择性必修下册.pptx
- 市场形态周报.docx
最近下载
- (高清版)B 15982-2012 医院消毒卫生标准.pdf VIP
- 医院护理人员绩效考核评价制度.doc VIP
- JTG E 20-2011公路工程沥青及沥青混合料试验规程释义手册_(高清-无水印).pdf
- 初中英语新外研版七年级上册Unit 1 A new start课文讲解(2024秋).doc
- 可爱的四川 主题一:自然之美 第1课 享誉世界的超级明星-国宝大熊猫 教案.doc
- 机械安全培训PPT课件.ppt
- 昌吉市新联煤矿煤矿施工组织设计修改版.doc VIP
- 【精品课件】 苏科版信息技术五年级全一册 第3课 火柴人跳舞.ppt VIP
- ASME-B1.3-2007-个人中文翻译(仅供参考).docx VIP
- 《全面质量管理》习题集.docx VIP
文档评论(0)