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

📄 dbmaintainfrm.cs

📁 能对数据库进行维护
💻 CS
📖 第 1 页 / 共 3 页
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Data.SqlClient;
using DBMaintainDll.Data_Structure;

namespace DBMaintainDll
{
	/// <summary>
	/// DBMaintainFrm 的摘要说明。
	/// </summary>
	public class DBMaintainFrm : System.Windows.Forms.Form
	{
		private System.Windows.Forms.ToolBar toolBar;
		private System.Windows.Forms.ImageList imageList1;
		private System.Windows.Forms.ListBox listBox1;
		private System.Windows.Forms.GroupBox groupBox1;
		private System.ComponentModel.IContainer components;
		private System.Windows.Forms.ToolBarButton toolBarButton2;
		private System.Windows.Forms.ToolBarButton toolBarButton3;
		private System.Windows.Forms.ToolBarButton toolBarButton4;
		private System.Windows.Forms.ToolBarButton toolBarButton5;
		private System.Windows.Forms.ToolBarButton toolBarButton6;
		private System.Windows.Forms.ToolBarButton tBBCreatTable;


		public DataAccess da =new DataAccess();
		public string tablename;
		public string tablename0;
		private System.Windows.Forms.ContextMenu contextMenu1;
		private System.Windows.Forms.MenuItem menuItem1;
		private System.Windows.Forms.MenuItem menuItem2;
		private System.Windows.Forms.MenuItem menuItem3;
		public DataSet ds=new DataSet();
		public string SQL=null;
		public string constr=null;
		public static ArrayList tables=new ArrayList();
		private System.Windows.Forms.Label label1;
		private System.Windows.Forms.ComboBox cmbSearch1;
		private System.Windows.Forms.Label label2;
		private System.Windows.Forms.Label label3;
		private System.Windows.Forms.ComboBox cmbMath1;
		private System.Windows.Forms.TextBox txtKey1;
		private System.Windows.Forms.ComboBox cmbSearch2;
		private System.Windows.Forms.GroupBox groupBox2;
		private System.Windows.Forms.ComboBox cmbMatch2;
		private System.Windows.Forms.TextBox txtKey2;
		private System.Windows.Forms.Button btnSearch;
		public string ownerPermiton=null;
		public DataColumnCollection dcc=null;
		private System.Windows.Forms.ToolBarButton toolBarButton1;
		private System.Windows.Forms.ToolBarButton toolBarButton7;
		public DataTable dtcolums=null;
		private System.Windows.Forms.Label label4;
		private System.Windows.Forms.Label label5;
		private System.Windows.Forms.Label label6;
		private System.Windows.Forms.DataGrid dataGrid1;
		private System.Windows.Forms.DataGridTableStyle dataGridTableStyle1;
		public int CR=0;//currentRowIndex
		public string  IdentityCol=null;
		private System.Windows.Forms.ToolBarButton toolBarButton8;// 数据库中主键自增长字段
		public int IdentityColIndex=0;//数据库中主键自增长字段在表中的位置是第几列
		
	
		//		public string ConnStr="";


		public DBMaintainFrm()
		{
			//
			// Windows 窗体设计器支持所必需的
			//
			InitializeComponent();
			//
			// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
			//
		}


		protected override void Dispose( bool disposing )
		{
			if( disposing )
			{
				if(components != null)
				{
					components.Dispose();
				}
			}
			base.Dispose( disposing );
		}


		#region Windows 窗体设计器生成的代码
		/// <summary>
		/// 设计器支持所需的方法 - 不要使用代码编辑器修改
		/// 此方法的内容。
		/// </summary>
		private void InitializeComponent()
		{
			this.components = new System.ComponentModel.Container();
			System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(DBMaintainFrm));
			this.toolBar = new System.Windows.Forms.ToolBar();
			this.tBBCreatTable = new System.Windows.Forms.ToolBarButton();
			this.toolBarButton2 = new System.Windows.Forms.ToolBarButton();
			this.toolBarButton3 = new System.Windows.Forms.ToolBarButton();
			this.toolBarButton4 = new System.Windows.Forms.ToolBarButton();
			this.toolBarButton5 = new System.Windows.Forms.ToolBarButton();
			this.toolBarButton6 = new System.Windows.Forms.ToolBarButton();
			this.toolBarButton1 = new System.Windows.Forms.ToolBarButton();
			this.toolBarButton7 = new System.Windows.Forms.ToolBarButton();
			this.toolBarButton8 = new System.Windows.Forms.ToolBarButton();
			this.imageList1 = new System.Windows.Forms.ImageList(this.components);
			this.listBox1 = new System.Windows.Forms.ListBox();
			this.contextMenu1 = new System.Windows.Forms.ContextMenu();
			this.menuItem1 = new System.Windows.Forms.MenuItem();
			this.menuItem2 = new System.Windows.Forms.MenuItem();
			this.menuItem3 = new System.Windows.Forms.MenuItem();
			this.groupBox1 = new System.Windows.Forms.GroupBox();
			this.label1 = new System.Windows.Forms.Label();
			this.cmbSearch1 = new System.Windows.Forms.ComboBox();
			this.label2 = new System.Windows.Forms.Label();
			this.label3 = new System.Windows.Forms.Label();
			this.cmbMath1 = new System.Windows.Forms.ComboBox();
			this.txtKey1 = new System.Windows.Forms.TextBox();
			this.cmbSearch2 = new System.Windows.Forms.ComboBox();
			this.groupBox2 = new System.Windows.Forms.GroupBox();
			this.label6 = new System.Windows.Forms.Label();
			this.label5 = new System.Windows.Forms.Label();
			this.label4 = new System.Windows.Forms.Label();
			this.btnSearch = new System.Windows.Forms.Button();
			this.txtKey2 = new System.Windows.Forms.TextBox();
			this.cmbMatch2 = new System.Windows.Forms.ComboBox();
			this.dataGrid1 = new System.Windows.Forms.DataGrid();
			this.dataGridTableStyle1 = new System.Windows.Forms.DataGridTableStyle();
			this.groupBox1.SuspendLayout();
			this.groupBox2.SuspendLayout();
			((System.ComponentModel.ISupportInitialize)(this.dataGrid1)).BeginInit();
			this.SuspendLayout();
			// 
			// toolBar
			// 
			this.toolBar.Buttons.AddRange(new System.Windows.Forms.ToolBarButton[] {
																					   this.tBBCreatTable,
																					   this.toolBarButton2,
																					   this.toolBarButton3,
																					   this.toolBarButton4,
																					   this.toolBarButton5,
																					   this.toolBarButton6,
																					   this.toolBarButton1,
																					   this.toolBarButton7,
																					   this.toolBarButton8});
			this.toolBar.DropDownArrows = true;
			this.toolBar.ImageList = this.imageList1;
			this.toolBar.Location = new System.Drawing.Point(0, 0);
			this.toolBar.Name = "toolBar";
			this.toolBar.ShowToolTips = true;
			this.toolBar.Size = new System.Drawing.Size(1016, 28);
			this.toolBar.TabIndex = 0;
			this.toolBar.ButtonClick += new System.Windows.Forms.ToolBarButtonClickEventHandler(this.toolBar_ButtonClick);
			// 
			// tBBCreatTable
			// 
			this.tBBCreatTable.ImageIndex = 1;
			this.tBBCreatTable.ToolTipText = "创建表";
			// 
			// toolBarButton2
			// 
			this.toolBarButton2.ImageIndex = 2;
			this.toolBarButton2.ToolTipText = "修改表结构";
			// 
			// toolBarButton3
			// 
			this.toolBarButton3.ImageIndex = 3;
			this.toolBarButton3.ToolTipText = "删除表";
			// 
			// toolBarButton4
			// 
			this.toolBarButton4.ImageIndex = 4;
			this.toolBarButton4.ToolTipText = "增加记录";
			// 
			// toolBarButton5
			// 
			this.toolBarButton5.ImageIndex = 5;
			this.toolBarButton5.ToolTipText = "删除记录";
			// 
			// toolBarButton6
			// 
			this.toolBarButton6.ImageIndex = 6;
			this.toolBarButton6.ToolTipText = "保存修改";
			// 
			// toolBarButton1
			// 
			this.toolBarButton1.ImageIndex = 8;
			this.toolBarButton1.ToolTipText = "检索";
			// 
			// toolBarButton7
			// 
			this.toolBarButton7.ImageIndex = 7;
			this.toolBarButton7.ToolTipText = "查看全表";
			// 
			// toolBarButton8
			// 
			this.toolBarButton8.ImageIndex = 9;
			this.toolBarButton8.ToolTipText = "刷新";
			// 
			// imageList1
			// 
			this.imageList1.ImageSize = new System.Drawing.Size(16, 16);
			this.imageList1.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageList1.ImageStream")));
			this.imageList1.TransparentColor = System.Drawing.Color.Transparent;
			// 
			// listBox1
			// 
			this.listBox1.HorizontalScrollbar = true;
			this.listBox1.ItemHeight = 12;
			this.listBox1.Location = new System.Drawing.Point(8, 8);
			this.listBox1.Name = "listBox1";
			this.listBox1.Size = new System.Drawing.Size(152, 472);
			this.listBox1.TabIndex = 1;
			this.listBox1.SelectedIndexChanged += new System.EventHandler(this.listBox1_SelectedIndexChanged);
			// 
			// contextMenu1
			// 
			this.contextMenu1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
																						 this.menuItem1,
																						 this.menuItem2,
																						 this.menuItem3});
			// 
			// menuItem1
			// 
			this.menuItem1.Index = 0;
			this.menuItem1.Text = "增加一行";
			this.menuItem1.Click += new System.EventHandler(this.menuItem1_Click);
			// 
			// menuItem2
			// 
			this.menuItem2.Index = 1;
			this.menuItem2.Text = "删除一行";
			this.menuItem2.Click += new System.EventHandler(this.menuItem2_Click);
			// 
			// menuItem3
			// 
			this.menuItem3.Index = 2;
			this.menuItem3.Text = "保存更改";
			this.menuItem3.Click += new System.EventHandler(this.menuItem3_Click);
			// 
			// groupBox1
			// 
			this.groupBox1.Controls.Add(this.listBox1);
			this.groupBox1.Location = new System.Drawing.Point(0, 32);
			this.groupBox1.Name = "groupBox1";
			this.groupBox1.Size = new System.Drawing.Size(168, 488);
			this.groupBox1.TabIndex = 5;
			this.groupBox1.TabStop = false;
			this.groupBox1.Text = "表名";
			// 
			// label1
			// 
			this.label1.Location = new System.Drawing.Point(48, 24);
			this.label1.Name = "label1";
			this.label1.Size = new System.Drawing.Size(56, 16);
			this.label1.TabIndex = 6;
			this.label1.Text = "检索项 ";
			// 
			// cmbSearch1
			// 
			this.cmbSearch1.Location = new System.Drawing.Point(104, 16);
			this.cmbSearch1.Name = "cmbSearch1";
			this.cmbSearch1.Size = new System.Drawing.Size(136, 20);
			this.cmbSearch1.TabIndex = 7;
			this.cmbSearch1.SelectedIndexChanged += new System.EventHandler(this.cmbSearch1_SelectedIndexChanged);
			// 
			// label2
			// 
			this.label2.Location = new System.Drawing.Point(288, 16);
			this.label2.Name = "label2";
			this.label2.Size = new System.Drawing.Size(64, 16);
			this.label2.TabIndex = 8;
			this.label2.Text = "匹配条件";
			// 
			// label3
			// 
			this.label3.Location = new System.Drawing.Point(552, 16);
			this.label3.Name = "label3";
			this.label3.Size = new System.Drawing.Size(48, 16);
			this.label3.TabIndex = 9;
			this.label3.Text = "关键字";
			// 
			// cmbMath1
			// 
			this.cmbMath1.Location = new System.Drawing.Point(376, 16);
			this.cmbMath1.Name = "cmbMath1";
			this.cmbMath1.Size = new System.Drawing.Size(120, 20);
			this.cmbMath1.TabIndex = 10;
			this.cmbMath1.Click += new System.EventHandler(this.cmbMath1_Click);
			this.cmbMath1.SelectedIndexChanged += new System.EventHandler(this.cmbMath1_SelectedIndexChanged);
			// 
			// txtKey1
			// 
			this.txtKey1.Location = new System.Drawing.Point(624, 16);
			this.txtKey1.Name = "txtKey1";
			this.txtKey1.Size = new System.Drawing.Size(104, 21);
			this.txtKey1.TabIndex = 11;
			this.txtKey1.Text = "";
			this.txtKey1.TextChanged += new System.EventHandler(this.txtKey1_TextChanged);
			// 
			// cmbSearch2
			// 
			this.cmbSearch2.Location = new System.Drawing.Point(104, 48);
			this.cmbSearch2.Name = "cmbSearch2";
			this.cmbSearch2.Size = new System.Drawing.Size(136, 20);
			this.cmbSearch2.TabIndex = 12;
			this.cmbSearch2.SelectedIndexChanged += new System.EventHandler(this.cmbSearch2_SelectedIndexChanged);
			// 
			// groupBox2
			// 
			this.groupBox2.Controls.Add(this.label6);
			this.groupBox2.Controls.Add(this.label5);
			this.groupBox2.Controls.Add(this.label4);
			this.groupBox2.Controls.Add(this.btnSearch);
			this.groupBox2.Controls.Add(this.txtKey2);
			this.groupBox2.Controls.Add(this.cmbMatch2);
			this.groupBox2.Controls.Add(this.cmbSearch2);
			this.groupBox2.Controls.Add(this.label2);
			this.groupBox2.Controls.Add(this.cmbSearch1);
			this.groupBox2.Controls.Add(this.label3);
			this.groupBox2.Controls.Add(this.cmbMath1);
			this.groupBox2.Controls.Add(this.label1);
			this.groupBox2.Controls.Add(this.txtKey1);
			this.groupBox2.Location = new System.Drawing.Point(176, 32);
			this.groupBox2.Name = "groupBox2";
			this.groupBox2.Size = new System.Drawing.Size(816, 80);
			this.groupBox2.TabIndex = 13;
			this.groupBox2.TabStop = false;
			this.groupBox2.Text = "查询";
			this.groupBox2.Visible = false;
			// 
			// label6
			// 
			this.label6.Location = new System.Drawing.Point(552, 48);
			this.label6.Name = "label6";
			this.label6.Size = new System.Drawing.Size(48, 16);
			this.label6.TabIndex = 18;
			this.label6.Text = "关键字";
			// 
			// label5
			// 
			this.label5.Location = new System.Drawing.Point(288, 48);
			this.label5.Name = "label5";
			this.label5.Size = new System.Drawing.Size(64, 16);
			this.label5.TabIndex = 17;
			this.label5.Text = "匹配条件";
			// 
			// label4
			// 
			this.label4.Location = new System.Drawing.Point(48, 48);
			this.label4.Name = "label4";
			this.label4.Size = new System.Drawing.Size(56, 16);
			this.label4.TabIndex = 16;
			this.label4.Text = "检索项 ";
			// 
			// btnSearch
			// 
			this.btnSearch.Location = new System.Drawing.Point(752, 24);
			this.btnSearch.Name = "btnSearch";
			this.btnSearch.Size = new System.Drawing.Size(48, 32);
			this.btnSearch.TabIndex = 15;
			this.btnSearch.Text = "查询";
			this.btnSearch.Click += new System.EventHandler(this.btnSearch_Click);
			// 

⌨️ 快捷键说明

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