using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.OleDb;

public partial class memdel : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void btndel_Click(object sender, EventArgs e)
    {
      string strcon = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=|DataDirectory|mydata.mdb";
      OleDbConnection conn = new OleDbConnection(strcon);
      string sql0 = "select count(*) from members where mname='" + txtname.Text + "' and mpwd='" + txtpwd.Text + "'";
      conn.Open();
      OleDbCommand ocmd = new OleDbCommand(sql0, conn);
      if (Convert.ToInt32(ocmd.ExecuteScalar())>0)
      {
        string sql2 = "delete from members where mname='" + txtname.Text + "'";
        OleDbCommand ocmddel = new OleDbCommand(sql2, conn);
        ocmddel.ExecuteNonQuery();
        Response.Write("删除成功");
      }
      else
      {
        Response.Write("用户名或密码不正确，请核对信息");
      }
    }
}
