CSDN首页 空间 新闻 论坛 Blog 下载 读书 网摘 搜索 .NET Java 视频 接项目 求职 在线学习 买书 程序员 通知
山寨机中的战斗机! 程序优化工程师到底对IT界有没有贡献
CSDN社区
搜索 收藏 打印 关闭
CSDN社区 >  .NET技术 >  C#

大家进来帮帮小弟,很简单的问题.多谢!!

楼主bylmy()2005-04-01 13:46:54 在 .NET技术 / C# 提问

这段代码"clear.aspx"是用来清空数据库的,如何在点击该页上某一个清除按钮后,先出一个窗口提示是否确定清除,然后有确定或取消,如果点取消返回页面,如果点确定后,再跳出一个小窗口,显示该表已经清空,然后点确定关闭小窗口,,如何做?.   另外在该页面下添加一个返回按钮,返回上一页,比如上一页是"clearlogin.aspx".哪位大侠能直接把这三个功能添加到小弟代码中啊,谢谢!!  
   
   
  using   System;  
  using   System.Collections;  
  using   System.ComponentModel;  
  using   System.Data;  
  using   System.Drawing;  
  using   System.Web;  
  using   System.Web.SessionState;  
  using   System.Web.UI;  
  using   System.Web.UI.WebControls;  
  using   System.Web.UI.HtmlControls;  
  using   System.Data.SqlClient;  
   
   
  namespace   CourseWork3  
  {  
  ///   <summary>  
   
  ///   </summary>  
  public   class   WebForm12   :   System.Web.UI.Page  
  {  
  protected   System.Web.UI.WebControls.Label   Label1;  
  protected   System.Web.UI.WebControls.Button   Button1;  
  protected   System.Web.UI.WebControls.Button   Button2;  
  protected   System.Web.UI.WebControls.Button   Button3;  
  protected   System.Web.UI.WebControls.Button   Button4;  
  protected   System.Web.UI.WebControls.Button   Button5;  
  protected   System.Web.UI.WebControls.Label   Label2;  
  protected   System.Data.SqlClient.SqlConnection   VisitConnection;  
   
  private   void   Page_Load(object   sender,   System.EventArgs   e)  
  {  
   
  }  
   
  #region    
  override   protected   void   OnInit(EventArgs   e)  
  {  
  //  
   
  //  
  InitializeComponent();  
  base.OnInit(e);  
  }  
   
  ///   <summary>  
   
  ///   </summary>  
  private   void   InitializeComponent()  
  {          
  this.VisitConnection   =   new   System.Data.SqlClient.SqlConnection();  
  this.Button5.Click   +=   new   System.EventHandler(this.Button5_Click);  
  this.Button4.Click   +=   new   System.EventHandler(this.Button4_Click);  
  this.Button3.Click   +=   new   System.EventHandler(this.Button3_Click);  
  this.Button2.Click   +=   new   System.EventHandler(this.Button2_Click);  
  this.Button1.Click   +=   new   System.EventHandler(this.Button1_Click);  
  //    
  //   VisitConnection  
  //    
  this.VisitConnection.ConnectionString   =   "workstation   id=erhtrc;packet   size=4096;integrated   security=SSPI;data   source=erthr"   +  
  "c;persist   security   info=False;initial   catalog=VisitDays";  
  this.Load   +=   new   System.EventHandler(this.Page_Load);  
   
  }  
  #endregion  
   
  private   void   Button1_Click(object   sender,   System.EventArgs   e)  
  {  
  try  
  {  
  VisitConnection.Open();  
  SqlCommand   cmd   =    
  new   SqlCommand("delete   from   Applicant",VisitConnection);  
  cmd.ExecuteReader();  
  }  
  finally{  
  VisitConnection.Close();  
       
  }  
   
  }  
   
  private   void   Button2_Click(object   sender,   System.EventArgs   e)  
  {  
  try  
  {  
  VisitConnection.Open();  
  SqlCommand   cmd   =    
  new   SqlCommand("delete   from   Applications",VisitConnection);  
  cmd.ExecuteReader();  
  }  
  finally  
  {  
  VisitConnection.Close();  
       
  }  
   
  }  
   
  private   void   Button3_Click(object   sender,   System.EventArgs   e)  
  {  
  try  
  {  
  VisitConnection.Open();  
  SqlCommand   cmd   =    
  new   SqlCommand("delete   from   Attending",VisitConnection);  
  cmd.ExecuteReader();  
  }  
  finally  
  {  
  VisitConnection.Close();  
       
  }  
  }  
   
  private   void   Button4_Click(object   sender,   System.EventArgs   e)  
  {  
  try  
  {  
  VisitConnection.Open();  
  SqlCommand   cmd   =    
  new   SqlCommand("delete   from   Course",VisitConnection);  
  cmd.ExecuteReader();  
  }  
  finally  
  {  
  VisitConnection.Close();  
       
  }  
   
  }  
   
  private   void   Button5_Click(object   sender,   System.EventArgs   e)  
  {  
  try  
  {  
  VisitConnection.Open();  
  SqlCommand   cmd   =    
  new   SqlCommand("delete   from   OpenDay",VisitConnection);  
  cmd.ExecuteReader();  
  }  
  finally  
  {  
  VisitConnection.Close();  
       
  }  
  }  
  }  
  }  
  问题点数:0、回复次数:4Top

1 楼bylmy()回复于 2005-04-01 14:12:17 得分 0

谁来帮我Top

2 楼bylmy()回复于 2005-04-01 15:31:52 得分 0

upTop

3 楼lizq2004(Lee)回复于 2005-04-01 15:46:15 得分 0

if   (MessageBox.Show("是否确定清除?","提示",MessageBoxButtons.OKCancel,MessageBoxIcon.Question)==DialogResult.OK)  
  {  
      //删除数据库  
        MessageBox.show("删除成功!");  
  }  
  else  
  {  
      //不删除    
  }  
   
  Top

4 楼bylmy()回复于 2005-04-01 22:44:05 得分 0

不行啊,小弟在VS.net里编译,有问题!Top

相关问题

  • 很简单的一个问题!多谢了
  • 简单问题,多谢!
  • 这几个问题可能很简单,可是我不懂,多谢赐教。
  • 屏幕鼠标位置判断简单问题请教,很急,多谢!
  • 问一个困饶我很长时间的简单问题,:),多谢了
  • 编译一个很简单的程序出错,大家帮忙看看,多谢了。
  • 看书发现的两个概念性问题,可能很简单,请说的详细一点!多谢帮忙!
  • 请大家帮忙看看这段代码(很简单的)有什么问题,多谢各位了。
  • 关于怎么用鼠标拖动的问题,很简单,在先等待,多谢指点
  • 也许很简单但我不知道,请问如何把datetime转换成smalldatetime,多谢

关键词

  • visitconnection
  • button
  • webcontrols
  • ui
  • eventhandler
  • click
  • protected
  • eventargs e
  • 确定
  • sqlclient

得分解答快速导航

  • 帖主:bylmy

相关链接

  • CSDN .NET频道
  • .NET类图书
  • C#类图书
  • .NET类源码下载

广告也精彩

反馈

请通过下述方式给我们反馈
反馈
提问
网站简介|广告服务|VIP资费标准|银行汇款帐号|网站地图|帮助|联系方式|诚聘英才|English|问题报告
北京创新乐知广告有限公司 版权所有, 京 ICP 证 070598 号
世纪乐知(北京)网络技术有限公司 提供技术支持
Copyright © 2000-2008, CSDN.NET, All Rights Reserved
GongshangLogo