⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dbdroptableoperation.cs

📁 一个通用的数据库访问层
💻 CS
字号:
using System;
using System.Data;
using System.Data.OleDb;

namespace YariSoft.DBUtil
{
	public class DBDropTableOperation : DBSchemaOperation
	{
		#region Local variables
		private string	tableName = "";
		#endregion
		
		#region Constructor/Destructor
		public DBDropTableOperation( OleDbConnection Connection, string TableName )
		{
			this.connection = Connection;
			this.tableName = TableName;
		}
		#endregion

		#region Public functions
		public override bool PrepareSQL()
		{
			string tempSQL = "";

			DataTable constraints = this.connection.GetOleDbSchemaTable( OleDbSchemaGuid.Foreign_Keys, new object [] {null, null, this.tableName});
			foreach ( DataRow row in constraints.Rows ){
				tempSQL += "ALTER TABLE [" + row["FK_TABLE_NAME"].ToString() + "] DROP CONSTRAINT " + row["FK_NAME"].ToString()+ "\r\n";
			}
			constraints.Dispose();

			tempSQL +=  "DROP TABLE [" + this.tableName + "]";
			this.strSQL = tempSQL;
			return true;
		}
		#endregion
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -