最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
使用简单的方法进行批量删除数据
时间:2022-06-30 10:47:18 编辑:袖梨 来源:一聚教程网
在网上看到一些批量删除数据的例子.但是大部分是用的数组来保存所选的id.这样比较麻烦,也不容易被理解.我就拿个比较简单的方法来实现这个功能.(只看红色的部分即可,而且还加个删除提示窗口)
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.OleDb;
namespace overred.test
{
///
/// t1 的摘要说明。
///
public class t1 : System.Web.UI.Page
{
protected System.Web.UI.WebControls.Label message;
protected System.Web.UI.WebControls.LinkButton showck;
protected System.Web.UI.WebControls.CheckBox CheckBox1;
protected System.Web.UI.WebControls.LinkButton delall;
protected System.Web.UI.WebControls.DataGrid dg;
private OleDbCommand cmd;
private OleDbConnection conn;
protected System.Web.UI.WebControls.LinkButton lb;
private string datas;
private void Page_Load(object sender, System.EventArgs e)
{
Session["s"]="dd";
// 在此处放置用户代码以初始化页面
if(!this.Page.IsPostBack)
Sql();
}
private DataSet Getds()
{
datas="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Server.MapPath("../overred.mdb");
conn = new OleDbConnection(datas);
conn.Open();
OleDbDataAdapter adp = new OleDbDataAdapter("select * from subnews order by news_order desc", conn);
DataSet ds = new DataSet(); adp.Fill(ds,"link");
return ds;
}
private void Sql()
{
alter();
using (DataSet dss=Getds())
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.OleDb;
namespace overred.test
{
///
/// t1 的摘要说明。
///
public class t1 : System.Web.UI.Page
{
protected System.Web.UI.WebControls.Label message;
protected System.Web.UI.WebControls.LinkButton showck;
protected System.Web.UI.WebControls.CheckBox CheckBox1;
protected System.Web.UI.WebControls.LinkButton delall;
protected System.Web.UI.WebControls.DataGrid dg;
private OleDbCommand cmd;
private OleDbConnection conn;
protected System.Web.UI.WebControls.LinkButton lb;
private string datas;
private void Page_Load(object sender, System.EventArgs e)
{
Session["s"]="dd";
// 在此处放置用户代码以初始化页面
if(!this.Page.IsPostBack)
Sql();
}
private DataSet Getds()
{
datas="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Server.MapPath("../overred.mdb");
conn = new OleDbConnection(datas);
conn.Open();
OleDbDataAdapter adp = new OleDbDataAdapter("select * from subnews order by news_order desc", conn);
DataSet ds = new DataSet(); adp.Fill(ds,"link");
return ds;
}
private void Sql()
{
alter();
using (DataSet dss=Getds())
相关文章
- 《无限暖暖》天星之羽获得位置介绍 12-20
- 《流放之路2》重铸台解锁方法介绍 12-20
- 《无限暖暖》瞄准那个亮亮的成就怎么做 12-20
- 《无限暖暖》魔气怪终结者完成方法 12-20
- 《无限暖暖》曙光毛团获得位置介绍 12-20
- 《无限暖暖》日光果获得位置介绍 12-20