• λ我爱Aspx >> Asp.Net >> .Net中删除数据前进行外键冲突检测
  • .Net中删除数据前进行外键冲突检测

  • :aspxer  Դ:internet  :2007-5-28 20:36:42  ؼ:.net,数据
  • ///

    /// 创建外键DataTable

    ///

    /// DataSet实例

    private DataSet BuildDataTables()

    {

    DataSet ds = new DataSet();

    DataTable table;

    DataColumnCollection columns;

    table = new DataTable("sysforeignkeys");

    columns = table.Columns;

    columns.Add("fkeyid", typeof(System.Int32));

    columns.Add("fkey", typeof(System.Int32));

    ds.Tables.Add(table);

    return ds;

    }

    #endregion

    }

    }

    使用该类时需要在DBMS中建一张系统表,并维护表中的数据,该表用来记录系统中各用户表的大概含义,用来告诉用户是什么地方发生了冲突:

    create table sysTables

    (

    id int not null IDENTITY(1,1) PRIMARY KEY CLUSTERED, /*ID*/

    tableName varchar(255), /*用户表名称*/

    description varchar(255) /*用户表描述*/

    )

    调用示例:

    public bool test()

    {

    //数据库连接字符串

    Ҷƪл˵?
  • һƪzt:Consuming Webservices over HTTPS (SSL)
    һƪWEB打印的相关技术分析