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

📄 form1.cs

📁 基于C#和SQL开发的合同管理系统。 可以实现一些简单的添加、删除功能。
💻 CS
📖 第 1 页 / 共 2 页
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Data.OleDb;

namespace 项目管理
{
	/// <summary>
	/// Form1 的摘要说明。
	/// </summary>
	public class Form1 : System.Windows.Forms.Form
	{
		private System.Windows.Forms.Label label1;
		private System.Windows.Forms.Label label2;
		private System.Data.OleDb.OleDbDataAdapter oleDbDataAdapter1;
		private System.Data.OleDb.OleDbCommand oleDbSelectCommand1;
		private System.Data.OleDb.OleDbConnection oleDbConnection1;
		private 项目管理.DataSet1 dataSet11;
		private System.Windows.Forms.TextBox CON_ID;
		private System.Windows.Forms.TextBox CON_NAME;
		/// <summary>
		/// 必需的设计器变量。
		/// </summary>
		private System.ComponentModel.Container components = null;
		private System.Windows.Forms.Button search;
		private System.Windows.Forms.Button exit;
		private System.Windows.Forms.DataGrid dataGrid1;
		private System.Windows.Forms.TextBox textBox1;
		private System.Windows.Forms.Label label3;
		private System.Windows.Forms.TextBox textBox2;
		private System.Windows.Forms.Label label4;
		private System.Windows.Forms.TextBox textBox3;
		private System.Windows.Forms.Label label5;
		private System.Windows.Forms.TextBox textBox4;
		private System.Windows.Forms.Label label6;
		private System.Windows.Forms.TextBox textBox5;
		private System.Windows.Forms.Label label7;
		private System.Windows.Forms.Button button1;
		private System.Windows.Forms.Button button2;
		private System.Windows.Forms.Button button3;
		public string command, tmpcom;
		private System.Data.OleDb.OleDbDataAdapter oleDbDataAdapter2;
		private System.Data.OleDb.OleDbCommand oleDbSelectCommand2;
		private 项目管理.DataSet2 dataSet21;

		public Form1()
		{
			//
			// Windows 窗体设计器支持所必需的
			//
			InitializeComponent();

			//
			// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
			//
		}

		/// <summary>
		/// 清理所有正在使用的资源。
		/// </summary>
		protected override void Dispose( bool disposing )
		{
			if( disposing )
			{
				if (components != null) 
				{
					components.Dispose();
				}
			}
			base.Dispose( disposing );
		}

		#region Windows 窗体设计器生成的代码
		/// <summary>
		/// 设计器支持所需的方法 - 不要使用代码编辑器修改
		/// 此方法的内容。
		/// </summary>
		private void InitializeComponent()
		{
			this.label1 = new System.Windows.Forms.Label();
			this.label2 = new System.Windows.Forms.Label();
			this.CON_ID = new System.Windows.Forms.TextBox();
			this.CON_NAME = new System.Windows.Forms.TextBox();
			this.dataSet11 = new 项目管理.DataSet1();
			this.search = new System.Windows.Forms.Button();
			this.exit = new System.Windows.Forms.Button();
			this.oleDbDataAdapter1 = new System.Data.OleDb.OleDbDataAdapter();
			this.oleDbSelectCommand1 = new System.Data.OleDb.OleDbCommand();
			this.oleDbConnection1 = new System.Data.OleDb.OleDbConnection();
			this.dataGrid1 = new System.Windows.Forms.DataGrid();
			this.textBox1 = new System.Windows.Forms.TextBox();
			this.label3 = new System.Windows.Forms.Label();
			this.textBox2 = new System.Windows.Forms.TextBox();
			this.label4 = new System.Windows.Forms.Label();
			this.textBox3 = new System.Windows.Forms.TextBox();
			this.label5 = new System.Windows.Forms.Label();
			this.textBox4 = new System.Windows.Forms.TextBox();
			this.label6 = new System.Windows.Forms.Label();
			this.textBox5 = new System.Windows.Forms.TextBox();
			this.label7 = new System.Windows.Forms.Label();
			this.button1 = new System.Windows.Forms.Button();
			this.button2 = new System.Windows.Forms.Button();
			this.button3 = new System.Windows.Forms.Button();
			this.oleDbDataAdapter2 = new System.Data.OleDb.OleDbDataAdapter();
			this.oleDbSelectCommand2 = new System.Data.OleDb.OleDbCommand();
			this.dataSet21 = new 项目管理.DataSet2();
			((System.ComponentModel.ISupportInitialize)(this.dataSet11)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.dataGrid1)).BeginInit();
			((System.ComponentModel.ISupportInitialize)(this.dataSet21)).BeginInit();
			this.SuspendLayout();
			// 
			// label1
			// 
			this.label1.Font = new System.Drawing.Font("楷体_GB2312", 21.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
			this.label1.Location = new System.Drawing.Point(32, 24);
			this.label1.Name = "label1";
			this.label1.Size = new System.Drawing.Size(136, 32);
			this.label1.TabIndex = 0;
			this.label1.Text = "合同编号";
			// 
			// label2
			// 
			this.label2.Font = new System.Drawing.Font("楷体_GB2312", 21.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
			this.label2.Location = new System.Drawing.Point(32, 72);
			this.label2.Name = "label2";
			this.label2.Size = new System.Drawing.Size(136, 32);
			this.label2.TabIndex = 1;
			this.label2.Text = "合同名称";
			// 
			// CON_ID
			// 
			this.CON_ID.Location = new System.Drawing.Point(176, 24);
			this.CON_ID.Name = "CON_ID";
			this.CON_ID.Size = new System.Drawing.Size(264, 31);
			this.CON_ID.TabIndex = 2;
			this.CON_ID.Text = "";
			this.CON_ID.TextChanged += new System.EventHandler(this.textBox1_TextChanged);
			// 
			// CON_NAME
			// 
			this.CON_NAME.Location = new System.Drawing.Point(176, 72);
			this.CON_NAME.Name = "CON_NAME";
			this.CON_NAME.Size = new System.Drawing.Size(264, 31);
			this.CON_NAME.TabIndex = 3;
			this.CON_NAME.Text = "";
			// 
			// dataSet11
			// 
			this.dataSet11.DataSetName = "DataSet1";
			this.dataSet11.Locale = new System.Globalization.CultureInfo("zh-CN");
			// 
			// search
			// 
			this.search.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
			this.search.Location = new System.Drawing.Point(488, 24);
			this.search.Name = "search";
			this.search.Size = new System.Drawing.Size(112, 40);
			this.search.TabIndex = 5;
			this.search.Text = "查  寻";
			this.search.Click += new System.EventHandler(this.search_Click);
			// 
			// exit
			// 
			this.exit.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
			this.exit.Location = new System.Drawing.Point(488, 480);
			this.exit.Name = "exit";
			this.exit.Size = new System.Drawing.Size(112, 40);
			this.exit.TabIndex = 6;
			this.exit.Text = "退  出";
			this.exit.Click += new System.EventHandler(this.exit_Click);
			// 
			// oleDbDataAdapter1
			// 
			this.oleDbDataAdapter1.SelectCommand = this.oleDbSelectCommand1;
			this.oleDbDataAdapter1.TableMappings.AddRange(new System.Data.Common.DataTableMapping[] {
																										new System.Data.Common.DataTableMapping("Table", "CONTRACT", new System.Data.Common.DataColumnMapping[] {
																																																					new System.Data.Common.DataColumnMapping("合同号", "合同号"),
																																																					new System.Data.Common.DataColumnMapping("合同名称", "合同名称"),
																																																					new System.Data.Common.DataColumnMapping("合同额", "合同额"),
																																																					new System.Data.Common.DataColumnMapping("签定日期", "签定日期"),
																																																					new System.Data.Common.DataColumnMapping("销售人", "销售人")})});
			// 
			// oleDbSelectCommand1
			// 
			this.oleDbSelectCommand1.CommandText = "SELECT CONTRACT.CONTRACT_ID AS 合同号, CONTRACT.NAME AS 合同名称, CONTRACT.AMOUNT AS 合同额" +
				", CONTRACT.BUSINESS_DATE AS 签定日期, EMPLOYEE.NAME AS 销售人 FROM CONTRACT INNER JOIN " +
				"EMPLOYEE ON CONTRACT.SALE_ID = EMPLOYEE.EMPLOYEE_ID";
			this.oleDbSelectCommand1.Connection = this.oleDbConnection1;
			// 
			// oleDbConnection1
			// 
			this.oleDbConnection1.ConnectionString = @"Integrated Security=SSPI;Packet Size=4096;Data Source=""XYH\MAOMIVAN"";Tag with column collation when possible=False;Initial Catalog=CONTRACT;Use Procedure for Prepare=1;Auto Translate=True;Persist Security Info=False;Provider=""SQLOLEDB.1"";Workstation ID=XYH;Use Encryption for Data=False";
			// 
			// dataGrid1
			// 
			this.dataGrid1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
				| System.Windows.Forms.AnchorStyles.Left) 
				| System.Windows.Forms.AnchorStyles.Right)));
			this.dataGrid1.DataMember = "CONTRACT";
			this.dataGrid1.DataSource = this.dataSet11;
			this.dataGrid1.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
			this.dataGrid1.HeaderForeColor = System.Drawing.SystemColors.ControlText;
			this.dataGrid1.Location = new System.Drawing.Point(40, 128);
			this.dataGrid1.Name = "dataGrid1";
			this.dataGrid1.Size = new System.Drawing.Size(568, 144);
			this.dataGrid1.TabIndex = 4;
			this.dataGrid1.Navigate += new System.Windows.Forms.NavigateEventHandler(this.dataGrid1_Navigate);
			// 
			// textBox1
			// 
			this.textBox1.Location = new System.Drawing.Point(184, 288);
			this.textBox1.Name = "textBox1";
			this.textBox1.Size = new System.Drawing.Size(264, 31);
			this.textBox1.TabIndex = 8;
			this.textBox1.Text = "";
			// 
			// label3
			// 
			this.label3.Font = new System.Drawing.Font("楷体_GB2312", 21.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
			this.label3.Location = new System.Drawing.Point(40, 288);
			this.label3.Name = "label3";
			this.label3.Size = new System.Drawing.Size(136, 32);
			this.label3.TabIndex = 7;
			this.label3.Text = "合同编号";
			// 
			// textBox2
			// 
			this.textBox2.Location = new System.Drawing.Point(184, 336);
			this.textBox2.Name = "textBox2";
			this.textBox2.Size = new System.Drawing.Size(264, 31);
			this.textBox2.TabIndex = 10;
			this.textBox2.Text = "";
			// 
			// label4
			// 
			this.label4.Font = new System.Drawing.Font("楷体_GB2312", 21.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
			this.label4.Location = new System.Drawing.Point(40, 336);
			this.label4.Name = "label4";
			this.label4.Size = new System.Drawing.Size(136, 32);
			this.label4.TabIndex = 9;
			this.label4.Text = "合同名称";
			// 
			// textBox3
			// 
			this.textBox3.Location = new System.Drawing.Point(184, 384);
			this.textBox3.Name = "textBox3";
			this.textBox3.Size = new System.Drawing.Size(264, 31);

⌨️ 快捷键说明

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