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

📄 publishcompany.cs

📁 《C#数据库项目案例导航》一书的配套光盘
💻 CS
📖 第 1 页 / 共 2 页
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Data.SqlClient;
namespace Library.UserInterface
{
	/// <summary>
	/// Publishing 的摘要说明。
	/// </summary>
	public class Publishing : System.Windows.Forms.Form
	{
		private System.Windows.Forms.Button btnDelete;
		private System.Windows.Forms.Label lblDatasetPosition;
		private System.Windows.Forms.Button btnPrevious;
		private System.Windows.Forms.Button btnNext;
		private System.Windows.Forms.Button btnLast;
		private System.Windows.Forms.Button btnFirst;
		private System.Windows.Forms.GroupBox groupBox1;
		private System.Windows.Forms.TextBox textEmail;
		private System.Windows.Forms.TextBox textAdress;
		private System.Windows.Forms.TextBox textName;
		private System.Windows.Forms.Label label4;
		private System.Windows.Forms.Label label2;
		private System.Windows.Forms.Label label1;
		private System.Windows.Forms.Label label3;
		private System.Windows.Forms.TextBox textTelNo;
		private System.Windows.Forms.Button btnExit;
		private System.Windows.Forms.GroupBox groupBox3;
		private System.Windows.Forms.Button btnAdd;
		private System.Windows.Forms.Button btnModify;
		private System.Windows.Forms.Button btnCancel;
		private System.Windows.Forms.Button btnApply;
		private System.Data.SqlClient.SqlConnection sqlConnection1;
		private System.Data.SqlClient.SqlDataAdapter sqlDataAdapter1;
		private System.Data.SqlClient.SqlCommand sqlSelectCommand1;
		private System.Data.SqlClient.SqlCommand sqlInsertCommand1;
		private System.Data.SqlClient.SqlCommand sqlUpdateCommand1;
		private System.Data.SqlClient.SqlCommand sqlDeleteCommand1;
		private Library.UserInterface.DataSetPublishing objDataSetPublishing;
		
		/// <summary>
		/// 必需的设计器变量。
		/// </summary>
		private System.ComponentModel.Container components = null;

		public Publishing()
		{
			//
			// 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()
		{
			System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(Publishing));
			this.btnDelete = new System.Windows.Forms.Button();
			this.lblDatasetPosition = new System.Windows.Forms.Label();
			this.btnPrevious = new System.Windows.Forms.Button();
			this.btnNext = new System.Windows.Forms.Button();
			this.btnLast = new System.Windows.Forms.Button();
			this.btnFirst = new System.Windows.Forms.Button();
			this.groupBox1 = new System.Windows.Forms.GroupBox();
			this.textEmail = new System.Windows.Forms.TextBox();
			this.textAdress = new System.Windows.Forms.TextBox();
			this.objDataSetPublishing = new Library.UserInterface.DataSetPublishing();
			this.textName = new System.Windows.Forms.TextBox();
			this.label4 = new System.Windows.Forms.Label();
			this.label2 = new System.Windows.Forms.Label();
			this.label1 = new System.Windows.Forms.Label();
			this.label3 = new System.Windows.Forms.Label();
			this.textTelNo = new System.Windows.Forms.TextBox();
			this.btnExit = new System.Windows.Forms.Button();
			this.groupBox3 = new System.Windows.Forms.GroupBox();
			this.btnAdd = new System.Windows.Forms.Button();
			this.btnModify = new System.Windows.Forms.Button();
			this.btnCancel = new System.Windows.Forms.Button();
			this.btnApply = new System.Windows.Forms.Button();
			this.sqlConnection1 = new System.Data.SqlClient.SqlConnection();
			this.sqlDataAdapter1 = new System.Data.SqlClient.SqlDataAdapter();
			this.sqlDeleteCommand1 = new System.Data.SqlClient.SqlCommand();
			this.sqlInsertCommand1 = new System.Data.SqlClient.SqlCommand();
			this.sqlSelectCommand1 = new System.Data.SqlClient.SqlCommand();
			this.sqlUpdateCommand1 = new System.Data.SqlClient.SqlCommand();
			this.groupBox1.SuspendLayout();
			((System.ComponentModel.ISupportInitialize)(this.objDataSetPublishing)).BeginInit();
			this.groupBox3.SuspendLayout();
			this.SuspendLayout();
			// 
			// btnDelete
			// 
			this.btnDelete.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
			this.btnDelete.Location = new System.Drawing.Point(432, 176);
			this.btnDelete.Name = "btnDelete";
			this.btnDelete.Size = new System.Drawing.Size(56, 24);
			this.btnDelete.TabIndex = 28;
			this.btnDelete.Text = "删除";
			// 
			// lblDatasetPosition
			// 
			this.lblDatasetPosition.Anchor = System.Windows.Forms.AnchorStyles.Top;
			this.lblDatasetPosition.BackColor = System.Drawing.Color.White;
			this.lblDatasetPosition.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
			this.lblDatasetPosition.Location = new System.Drawing.Point(224, 15);
			this.lblDatasetPosition.Name = "lblDatasetPosition";
			this.lblDatasetPosition.Size = new System.Drawing.Size(64, 24);
			this.lblDatasetPosition.TabIndex = 25;
			this.lblDatasetPosition.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
			// 
			// btnPrevious
			// 
			this.btnPrevious.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
			this.btnPrevious.Image = ((System.Drawing.Image)(resources.GetObject("btnPrevious.Image")));
			this.btnPrevious.Location = new System.Drawing.Point(192, 15);
			this.btnPrevious.Name = "btnPrevious";
			this.btnPrevious.Size = new System.Drawing.Size(32, 24);
			this.btnPrevious.TabIndex = 24;
			this.btnPrevious.Click += new System.EventHandler(this.btnPrevious_Click);
			// 
			// btnNext
			// 
			this.btnNext.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
			this.btnNext.Image = ((System.Drawing.Image)(resources.GetObject("btnNext.Image")));
			this.btnNext.Location = new System.Drawing.Point(288, 15);
			this.btnNext.Name = "btnNext";
			this.btnNext.Size = new System.Drawing.Size(32, 24);
			this.btnNext.TabIndex = 23;
			this.btnNext.Click += new System.EventHandler(this.btnNext_Click);
			// 
			// btnLast
			// 
			this.btnLast.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
			this.btnLast.Image = ((System.Drawing.Image)(resources.GetObject("btnLast.Image")));
			this.btnLast.Location = new System.Drawing.Point(320, 15);
			this.btnLast.Name = "btnLast";
			this.btnLast.Size = new System.Drawing.Size(32, 24);
			this.btnLast.TabIndex = 22;
			this.btnLast.Click += new System.EventHandler(this.btnLast_Click);
			// 
			// btnFirst
			// 
			this.btnFirst.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
			this.btnFirst.Image = ((System.Drawing.Image)(resources.GetObject("btnFirst.Image")));
			this.btnFirst.Location = new System.Drawing.Point(160, 15);
			this.btnFirst.Name = "btnFirst";
			this.btnFirst.Size = new System.Drawing.Size(32, 24);
			this.btnFirst.TabIndex = 21;
			this.btnFirst.Click += new System.EventHandler(this.btnFirst_Click);
			// 
			// groupBox1
			// 
			this.groupBox1.Controls.Add(this.textEmail);
			this.groupBox1.Controls.Add(this.textAdress);
			this.groupBox1.Controls.Add(this.textName);
			this.groupBox1.Controls.Add(this.label4);
			this.groupBox1.Controls.Add(this.label2);
			this.groupBox1.Controls.Add(this.label1);
			this.groupBox1.Controls.Add(this.label3);
			this.groupBox1.Controls.Add(this.textTelNo);
			this.groupBox1.Font = new System.Drawing.Font("宋体", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
			this.groupBox1.Location = new System.Drawing.Point(52, 56);
			this.groupBox1.Name = "groupBox1";
			this.groupBox1.Size = new System.Drawing.Size(316, 232);
			this.groupBox1.TabIndex = 20;
			this.groupBox1.TabStop = false;
			this.groupBox1.Text = "出版社信息维护";
			// 
			// textEmail
			// 
			this.textEmail.Location = new System.Drawing.Point(96, 112);
			this.textEmail.Name = "textEmail";
			this.textEmail.Size = new System.Drawing.Size(208, 23);
			this.textEmail.TabIndex = 10;
			this.textEmail.Text = "";
			// 
			// textAdress
			// 
			this.textAdress.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.objDataSetPublishing, "PublishCompany.PublishAddress"));
			this.textAdress.Location = new System.Drawing.Point(96, 66);
			this.textAdress.Name = "textAdress";
			this.textAdress.Size = new System.Drawing.Size(208, 23);
			this.textAdress.TabIndex = 8;
			this.textAdress.Text = "";
			// 
			// objDataSetPublishing
			// 
			this.objDataSetPublishing.DataSetName = "DataSetPublishing";
			this.objDataSetPublishing.Locale = new System.Globalization.CultureInfo("zh-CN");
			// 
			// textName
			// 
			this.textName.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.objDataSetPublishing, "PublishCompany.PublishName"));
			this.textName.Location = new System.Drawing.Point(96, 24);
			this.textName.Name = "textName";
			this.textName.Size = new System.Drawing.Size(208, 23);
			this.textName.TabIndex = 7;
			this.textName.Text = "";
			// 
			// label4
			// 
			this.label4.Location = new System.Drawing.Point(8, 112);
			this.label4.Name = "label4";
			this.label4.Size = new System.Drawing.Size(96, 23);
			this.label4.TabIndex = 3;
			this.label4.Text = "出版社Email";
			// 
			// label2
			// 
			this.label2.Location = new System.Drawing.Point(8, 72);
			this.label2.Name = "label2";
			this.label2.Size = new System.Drawing.Size(88, 23);
			this.label2.TabIndex = 1;
			this.label2.Text = "出版社地址";
			// 
			// label1
			// 
			this.label1.Location = new System.Drawing.Point(8, 32);
			this.label1.Name = "label1";
			this.label1.Size = new System.Drawing.Size(88, 23);
			this.label1.TabIndex = 0;
			this.label1.Text = "出版社名称";
			// 
			// label3
			// 
			this.label3.Location = new System.Drawing.Point(16, 160);
			this.label3.Name = "label3";
			this.label3.Size = new System.Drawing.Size(64, 23);
			this.label3.TabIndex = 2;
			this.label3.Text = "联系电话";
			// 
			// textTelNo
			// 
			this.textTelNo.Location = new System.Drawing.Point(96, 160);
			this.textTelNo.Name = "textTelNo";
			this.textTelNo.Size = new System.Drawing.Size(208, 23);
			this.textTelNo.TabIndex = 9;
			this.textTelNo.Text = "";
			// 
			// btnExit
			// 
			this.btnExit.Location = new System.Drawing.Point(424, 232);
			this.btnExit.Name = "btnExit";
			this.btnExit.Size = new System.Drawing.Size(72, 32);
			this.btnExit.TabIndex = 27;
			this.btnExit.Text = "退出";
			this.btnExit.Click += new System.EventHandler(this.btnExit_Click);
			// 
			// groupBox3
			// 
			this.groupBox3.Controls.Add(this.btnAdd);
			this.groupBox3.Controls.Add(this.btnModify);
			this.groupBox3.Controls.Add(this.btnCancel);
			this.groupBox3.Controls.Add(this.btnApply);
			this.groupBox3.Location = new System.Drawing.Point(384, 64);
			this.groupBox3.Name = "groupBox3";
			this.groupBox3.Size = new System.Drawing.Size(144, 96);
			this.groupBox3.TabIndex = 29;
			this.groupBox3.TabStop = false;
			this.groupBox3.Text = "添加/ 修改";
			// 
			// btnAdd
			// 
			this.btnAdd.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
			this.btnAdd.Location = new System.Drawing.Point(16, 16);
			this.btnAdd.Name = "btnAdd";
			this.btnAdd.Size = new System.Drawing.Size(56, 24);
			this.btnAdd.TabIndex = 13;
			this.btnAdd.Text = "添加";
			this.btnAdd.Click += new System.EventHandler(this.btnAdd_Click);
			// 
			// btnModify
			// 
			this.btnModify.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
			this.btnModify.Location = new System.Drawing.Point(80, 16);
			this.btnModify.Name = "btnModify";
			this.btnModify.Size = new System.Drawing.Size(56, 24);
			this.btnModify.TabIndex = 15;
			this.btnModify.Text = "修改";
			this.btnModify.Click += new System.EventHandler(this.btnModify_Click);
			// 
			// btnCancel
			// 
			this.btnCancel.Location = new System.Drawing.Point(16, 56);
			this.btnCancel.Name = "btnCancel";
			this.btnCancel.Size = new System.Drawing.Size(56, 24);
			this.btnCancel.TabIndex = 11;
			this.btnCancel.Text = "取消";
			this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
			// 
			// btnApply
			// 
			this.btnApply.Location = new System.Drawing.Point(80, 56);
			this.btnApply.Name = "btnApply";
			this.btnApply.Size = new System.Drawing.Size(56, 24);
			this.btnApply.TabIndex = 12;
			this.btnApply.Text = "确定";
			this.btnApply.Click += new System.EventHandler(this.btnApply_Click);
			// 
			// sqlConnection1
			// 
			this.sqlConnection1.ConnectionString = "workstation id=localhost;packet size=4096;integrated security=SSPI;data source=lo" +
				"calhost;persist security info=False;initial catalog=BookManager";
			// 
			// sqlDataAdapter1
			// 
			this.sqlDataAdapter1.DeleteCommand = this.sqlDeleteCommand1;
			this.sqlDataAdapter1.InsertCommand = this.sqlInsertCommand1;
			this.sqlDataAdapter1.SelectCommand = this.sqlSelectCommand1;
			this.sqlDataAdapter1.TableMappings.AddRange(new System.Data.Common.DataTableMapping[] {
																									  new System.Data.Common.DataTableMapping("Table", "PublishCompany", new System.Data.Common.DataColumnMapping[] {
																																																						new System.Data.Common.DataColumnMapping("PublishName", "PublishName"),
																																																						new System.Data.Common.DataColumnMapping("PublishAddress", "PublishAddress"),
																																																						new System.Data.Common.DataColumnMapping("PublishPhoneNo", "PublishPhoneNo"),
																																																						new System.Data.Common.DataColumnMapping("PbulishEmail", "PbulishEmail")})});
			this.sqlDataAdapter1.UpdateCommand = this.sqlUpdateCommand1;
			// 
			// sqlDeleteCommand1
			// 
			this.sqlDeleteCommand1.CommandText = @"DELETE FROM PublishCompany WHERE (PublishName = @Original_PublishName) AND (PbulishEmail = @Original_PbulishEmail OR @Original_PbulishEmail IS NULL AND PbulishEmail IS NULL) AND (PublishAddress = @Original_PublishAddress OR @Original_PublishAddress IS NULL AND PublishAddress IS NULL) AND (PublishPhoneNo = @Original_PublishPhoneNo OR @Original_PublishPhoneNo IS NULL AND PublishPhoneNo IS NULL)";

⌨️ 快捷键说明

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