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.OleDb;
/// <summary>
/// 为数据的完整性，执行ROW删除时，同时删除与ROW相关的其他类容。。。。。
/// </summary>
public class getDelete
{
    public getDelete()
    {
        //
        // TODO: 在此处添加构造函数逻辑
        //
    }
    //为完整性删除专门写个方法。。。。
    public static void toDelete(string connectString,string sql)
    {
        OleDbConnection conn = new OleDbConnection(connectString);
        conn.Open();
        OleDbCommand cmd = new OleDbCommand(sql, conn);
        cmd.ExecuteNonQuery();
        conn.Close();
    }

    /// <summary>
    /// 执行完整性删除
    /// </summary>
    /// <param name="tableName">表名</param>
    /// <param name="name">字段名</param>
    /// <param name="id">字段值</param>
    public static void AllDelete(string tableName,string name,int id)
    {
       
            string sql = "delete from "+tableName+" where "+name+"=" + id;
            toDelete(DAL.DbConn.GetConnectionString(), sql);
       
    }
}
