Batch delete data using a simple method

Source: Internet
Author: User
You can see some examples of batch data deletion on the Internet. however, most of them use arrays to save the selected id. this is troublesome and difficult to understand. I will use a simple method to implement this function. (just look at the red part, and add a delete prompt window)
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
{
/// <Summary>
/// Summary of t1.
/// </Summary>
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 ";
// Place user code here to initialize the page
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 ())

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.