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

📄 form1.cs

📁 java基础方面的一些实例代码
💻 CS
📖 第 1 页 / 共 3 页
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Data.OleDb;

namespace mCaoADOWinApp
{
	/// <summary>
	/// Form1 的摘要说明。
	/// </summary>
	public class Form1 : System.Windows.Forms.Form
	{
		private System.Windows.Forms.DataGrid dataGrid1;
		private System.Windows.Forms.GroupBox groupBox1;
		private System.Windows.Forms.ListBox listBox1;
		private System.Windows.Forms.Button SqlConn;
		private System.Windows.Forms.Button OleDBConn;
		private System.Windows.Forms.Button IsConn;
		private System.Windows.Forms.Button DisConn;
		private System.Windows.Forms.Button ReadData;
		private System.Windows.Forms.Button XmlBuild;
		private System.Windows.Forms.Button NewTable;
		private System.Windows.Forms.Button button1;
		private System.Windows.Forms.GroupBox groupBox2;
		private System.Windows.Forms.TextBox textBox1;
		private System.Windows.Forms.TextBox TID;
		private System.Windows.Forms.TextBox textBox2;
		private System.Windows.Forms.TextBox TName;
		private System.Windows.Forms.TextBox textBox3;
		private System.Windows.Forms.ListBox listBox2;
		private System.Windows.Forms.Button PrevT;
		private System.Windows.Forms.Button TNext;
		private System.Windows.Forms.GroupBox groupBox3;
		private System.Windows.Forms.ComboBox MulQuery;
		private System.Windows.Forms.ListBox listBox3;
		private System.Windows.Forms.TextBox textBox4;
		private System.Windows.Forms.Button DeleteB;
		private System.Windows.Forms.Button InsertB;
		private System.Windows.Forms.Button ModifyB;
		private System.Windows.Forms.Button ReceiveB;
		private System.Windows.Forms.Button RejectB;
		private System.Windows.Forms.Button ResultB;

		private System.Data.DataSet MyDataSet;
		OleDbConnection MyOleConn;
		OleDbCommand MyComm;
		OleDbDataReader MyDataReader;
		DataTable [] MyDataTable = new DataTable[4];

		OleDbDataAdapter MyDataAdapter;
		bool bIsConnected = false;
		DataTable CurrentModifyTable;
		private System.Windows.Forms.Button DataReaderB;

		/// <summary>
		/// 必需的设计器变量。
		/// </summary>
		private System.ComponentModel.Container components = null;

		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.dataGrid1 = new System.Windows.Forms.DataGrid();
			this.SqlConn = new System.Windows.Forms.Button();
			this.OleDBConn = new System.Windows.Forms.Button();
			this.IsConn = new System.Windows.Forms.Button();
			this.DisConn = new System.Windows.Forms.Button();
			this.ReadData = new System.Windows.Forms.Button();
			this.groupBox1 = new System.Windows.Forms.GroupBox();
			this.listBox1 = new System.Windows.Forms.ListBox();
			this.XmlBuild = new System.Windows.Forms.Button();
			this.NewTable = new System.Windows.Forms.Button();
			this.button1 = new System.Windows.Forms.Button();
			this.groupBox2 = new System.Windows.Forms.GroupBox();
			this.listBox2 = new System.Windows.Forms.ListBox();
			this.TID = new System.Windows.Forms.TextBox();
			this.textBox1 = new System.Windows.Forms.TextBox();
			this.textBox2 = new System.Windows.Forms.TextBox();
			this.TName = new System.Windows.Forms.TextBox();
			this.textBox3 = new System.Windows.Forms.TextBox();
			this.PrevT = new System.Windows.Forms.Button();
			this.TNext = new System.Windows.Forms.Button();
			this.groupBox3 = new System.Windows.Forms.GroupBox();
			this.listBox3 = new System.Windows.Forms.ListBox();
			this.MulQuery = new System.Windows.Forms.ComboBox();
			this.textBox4 = new System.Windows.Forms.TextBox();
			this.DeleteB = new System.Windows.Forms.Button();
			this.InsertB = new System.Windows.Forms.Button();
			this.ModifyB = new System.Windows.Forms.Button();
			this.ReceiveB = new System.Windows.Forms.Button();
			this.RejectB = new System.Windows.Forms.Button();
			this.ResultB = new System.Windows.Forms.Button();
			this.DataReaderB = new System.Windows.Forms.Button();
			((System.ComponentModel.ISupportInitialize)(this.dataGrid1)).BeginInit();
			this.groupBox1.SuspendLayout();
			this.groupBox2.SuspendLayout();
			this.groupBox3.SuspendLayout();
			this.SuspendLayout();
			// 
			// dataGrid1
			// 
			this.dataGrid1.DataMember = "";
			this.dataGrid1.HeaderForeColor = System.Drawing.SystemColors.ControlText;
			this.dataGrid1.Location = new System.Drawing.Point(8, 8);
			this.dataGrid1.Name = "dataGrid1";
			this.dataGrid1.Size = new System.Drawing.Size(592, 208);
			this.dataGrid1.TabIndex = 0;
			// 
			// SqlConn
			// 
			this.SqlConn.Location = new System.Drawing.Point(8, 232);
			this.SqlConn.Name = "SqlConn";
			this.SqlConn.Size = new System.Drawing.Size(80, 24);
			this.SqlConn.TabIndex = 1;
			this.SqlConn.Text = "用sql连接";
			// 
			// OleDBConn
			// 
			this.OleDBConn.Location = new System.Drawing.Point(8, 262);
			this.OleDBConn.Name = "OleDBConn";
			this.OleDBConn.Size = new System.Drawing.Size(80, 24);
			this.OleDBConn.TabIndex = 1;
			this.OleDBConn.Text = "用oledb连接";
			this.OleDBConn.Click += new System.EventHandler(this.OleDBConn_Click);
			// 
			// IsConn
			// 
			this.IsConn.Location = new System.Drawing.Point(8, 292);
			this.IsConn.Name = "IsConn";
			this.IsConn.Size = new System.Drawing.Size(80, 24);
			this.IsConn.TabIndex = 1;
			this.IsConn.Text = "库连接否";
			this.IsConn.Click += new System.EventHandler(this.IsConn_Click);
			// 
			// DisConn
			// 
			this.DisConn.Location = new System.Drawing.Point(8, 322);
			this.DisConn.Name = "DisConn";
			this.DisConn.Size = new System.Drawing.Size(80, 24);
			this.DisConn.TabIndex = 1;
			this.DisConn.Text = "取消连接";
			this.DisConn.Click += new System.EventHandler(this.DisConn_Click);
			// 
			// ReadData
			// 
			this.ReadData.Location = new System.Drawing.Point(8, 352);
			this.ReadData.Name = "ReadData";
			this.ReadData.Size = new System.Drawing.Size(80, 24);
			this.ReadData.TabIndex = 1;
			this.ReadData.Text = "读取数据";
			this.ReadData.Click += new System.EventHandler(this.ReadData_Click);
			// 
			// groupBox1
			// 
			this.groupBox1.Controls.Add(this.listBox1);
			this.groupBox1.Location = new System.Drawing.Point(104, 224);
			this.groupBox1.Name = "groupBox1";
			this.groupBox1.Size = new System.Drawing.Size(96, 72);
			this.groupBox1.TabIndex = 2;
			this.groupBox1.TabStop = false;
			this.groupBox1.Text = "DataGrid显示";
			// 
			// listBox1
			// 
			this.listBox1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
			this.listBox1.ItemHeight = 12;
			this.listBox1.Items.AddRange(new object[] {
														  "教师信息表",
														  "学生信息表",
														  "课程信息表",
														  "教师开课表"});
			this.listBox1.Location = new System.Drawing.Point(8, 16);
			this.listBox1.Name = "listBox1";
			this.listBox1.Size = new System.Drawing.Size(72, 50);
			this.listBox1.TabIndex = 0;
			this.listBox1.SelectedIndexChanged += new System.EventHandler(this.listBox1_SelectedIndexChanged);
			// 
			// XmlBuild
			// 
			this.XmlBuild.Location = new System.Drawing.Point(104, 302);
			this.XmlBuild.Name = "XmlBuild";
			this.XmlBuild.Size = new System.Drawing.Size(96, 24);
			this.XmlBuild.TabIndex = 1;
			this.XmlBuild.Text = "生成Xml文件";
			this.XmlBuild.Click += new System.EventHandler(this.XmlBuild_Click);
			// 
			// NewTable
			// 
			this.NewTable.Location = new System.Drawing.Point(104, 330);
			this.NewTable.Name = "NewTable";
			this.NewTable.Size = new System.Drawing.Size(96, 24);
			this.NewTable.TabIndex = 1;
			this.NewTable.Text = "多表生新表例";
			this.NewTable.Click += new System.EventHandler(this.NewTable_Click);
			// 
			// button1
			// 
			this.button1.Location = new System.Drawing.Point(104, 360);
			this.button1.Name = "button1";
			this.button1.Size = new System.Drawing.Size(96, 24);
			this.button1.TabIndex = 1;
			this.button1.Text = "表1字段属性";
			this.button1.Click += new System.EventHandler(this.button1_Click);
			// 
			// groupBox2
			// 
			this.groupBox2.Controls.Add(this.listBox2);
			this.groupBox2.Controls.Add(this.TID);
			this.groupBox2.Controls.Add(this.textBox1);
			this.groupBox2.Controls.Add(this.textBox2);
			this.groupBox2.Controls.Add(this.TName);
			this.groupBox2.Controls.Add(this.textBox3);
			this.groupBox2.Controls.Add(this.PrevT);
			this.groupBox2.Controls.Add(this.TNext);
			this.groupBox2.Location = new System.Drawing.Point(224, 232);
			this.groupBox2.Name = "groupBox2";
			this.groupBox2.Size = new System.Drawing.Size(144, 160);
			this.groupBox2.TabIndex = 3;
			this.groupBox2.TabStop = false;
			this.groupBox2.Text = "单表查询 数据绑定";
			// 
			// listBox2
			// 
			this.listBox2.ItemHeight = 12;
			this.listBox2.Location = new System.Drawing.Point(64, 48);
			this.listBox2.Name = "listBox2";
			this.listBox2.Size = new System.Drawing.Size(72, 64);
			this.listBox2.TabIndex = 2;
			// 
			// TID
			// 
			this.TID.AcceptsReturn = true;
			this.TID.AcceptsTab = true;
			this.TID.Location = new System.Drawing.Point(8, 48);
			this.TID.Name = "TID";
			this.TID.Size = new System.Drawing.Size(40, 21);
			this.TID.TabIndex = 1;
			this.TID.Text = "ID";
			this.TID.TextChanged += new System.EventHandler(this.TID_TextChanged);
			// 
			// textBox1
			// 
			this.textBox1.BorderStyle = System.Windows.Forms.BorderStyle.None;
			this.textBox1.Enabled = false;
			this.textBox1.Location = new System.Drawing.Point(8, 32);
			this.textBox1.Name = "textBox1";
			this.textBox1.ReadOnly = true;
			this.textBox1.Size = new System.Drawing.Size(56, 14);
			this.textBox1.TabIndex = 0;
			this.textBox1.TabStop = false;
			this.textBox1.Text = "教师工号";
			// 
			// textBox2
			// 
			this.textBox2.BorderStyle = System.Windows.Forms.BorderStyle.None;
			this.textBox2.Enabled = false;
			this.textBox2.Location = new System.Drawing.Point(8, 72);
			this.textBox2.Name = "textBox2";
			this.textBox2.ReadOnly = true;
			this.textBox2.Size = new System.Drawing.Size(48, 14);
			this.textBox2.TabIndex = 0;
			this.textBox2.TabStop = false;
			this.textBox2.Text = "教师姓名";
			// 
			// TName
			// 
			this.TName.Location = new System.Drawing.Point(8, 96);
			this.TName.Name = "TName";
			this.TName.ReadOnly = true;
			this.TName.Size = new System.Drawing.Size(48, 21);

⌨️ 快捷键说明

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