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

📄 addressbook.cs

📁 this is a good book for the visual c#
💻 CS
📖 第 1 页 / 共 4 页
字号:
// Fig. 19.29: AddressBook.cs
// Using SQL statements to manipulate a database.

using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;

namespace AddressBook
{
   /// <summary>
   /// Summary description for AddressBook.
   /// </summary>
   public class AddressBook : System.Windows.Forms.Form
   {
      private System.Windows.Forms.TextBox faxTextBox;
      private System.Windows.Forms.TextBox homeTextBox;
      private System.Windows.Forms.TextBox firstTextBox;
      private System.Windows.Forms.TextBox stateTextBox;
      private System.Windows.Forms.TextBox idTextBox;
      private System.Windows.Forms.TextBox lastTextBox;
      private System.Windows.Forms.TextBox postalTextBox;
      private System.Windows.Forms.TextBox addressTextBox;
      private System.Windows.Forms.TextBox cityTextBox;
      private System.Windows.Forms.TextBox countryTextBox;
      private System.Windows.Forms.TextBox emailTextBox;
      private System.Data.DataSet dataSet1;
      private System.Data.OleDb.OleDbDataAdapter oleDbDataAdapter1;
      private System.Data.OleDb.OleDbCommand oleDbSelectCommand1;
      private System.Data.OleDb.OleDbCommand oleDbInsertCommand1;
      private System.Data.OleDb.OleDbCommand oleDbUpdateCommand1;
      private System.Data.OleDb.OleDbCommand oleDbDeleteCommand1;
      private System.Windows.Forms.TextBox statusTextBox;
      private System.Windows.Forms.Label addressLabel;
      private System.Windows.Forms.Label cityLabel;
      private System.Windows.Forms.Label stateLabel;
      private System.Windows.Forms.Label idLabel;
      private System.Windows.Forms.Label firstLabel;
      private System.Windows.Forms.Label lastLabel;
      private System.Windows.Forms.Label postalLabel;
      private System.Windows.Forms.Label countryLabel;
      private System.Windows.Forms.Label emailLabel;
      private System.Windows.Forms.Button clearButton;
      private System.Windows.Forms.Button helpButton;
      private System.Windows.Forms.Button findButton;
      private System.Windows.Forms.Button addButton;
      private System.Windows.Forms.Button updateButton;
      private System.Windows.Forms.Label faxLabel;
      private System.Windows.Forms.Label homeLabel;
      private System.Data.OleDb.OleDbCommand oleDbSelectCommand2;
      private System.Data.OleDb.OleDbCommand oleDbInsertCommand2;
      private System.Data.OleDb.OleDbCommand oleDbUpdateCommand2;
      private System.Data.OleDb.OleDbCommand oleDbDeleteCommand2;
      private System.Data.OleDb.OleDbConnection oleDbConnection1;
      /// <summary>
      /// Required designer variable.
      /// </summary>
      private System.ComponentModel.Container components = null;

      public AddressBook()
      {
         //
         // Required for Windows Form Designer support
         //
         InitializeComponent();

         //
         // TODO: Add any constructor code after InitializeComponent call
         //
         oleDbConnection1.Open();
      }

      /// <summary>
      /// Clean up any resources being used.
      /// </summary>
      protected override void Dispose( bool disposing )
      {
         if( disposing )
         {
            if (components != null) 
            {
               components.Dispose();
            }
         }
         base.Dispose( disposing );
      }

		#region Windows Form Designer generated code
      /// <summary>
      /// Required method for Designer support - do not modify
      /// the contents of this method with the code editor.
      /// </summary>
      private void InitializeComponent()
      {
          System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(AddressBook));
          this.countryLabel = new System.Windows.Forms.Label();
          this.emailLabel = new System.Windows.Forms.Label();
          this.addressLabel = new System.Windows.Forms.Label();
          this.cityLabel = new System.Windows.Forms.Label();
          this.stateLabel = new System.Windows.Forms.Label();
          this.faxTextBox = new System.Windows.Forms.TextBox();
          this.homeTextBox = new System.Windows.Forms.TextBox();
          this.idLabel = new System.Windows.Forms.Label();
          this.firstLabel = new System.Windows.Forms.Label();
          this.lastLabel = new System.Windows.Forms.Label();
          this.firstTextBox = new System.Windows.Forms.TextBox();
          this.stateTextBox = new System.Windows.Forms.TextBox();
          this.clearButton = new System.Windows.Forms.Button();
          this.helpButton = new System.Windows.Forms.Button();
          this.idTextBox = new System.Windows.Forms.TextBox();
          this.lastTextBox = new System.Windows.Forms.TextBox();
          this.findButton = new System.Windows.Forms.Button();
          this.addButton = new System.Windows.Forms.Button();
          this.updateButton = new System.Windows.Forms.Button();
          this.postalTextBox = new System.Windows.Forms.TextBox();
          this.addressTextBox = new System.Windows.Forms.TextBox();
          this.cityTextBox = new System.Windows.Forms.TextBox();
          this.postalLabel = new System.Windows.Forms.Label();
          this.countryTextBox = new System.Windows.Forms.TextBox();
          this.emailTextBox = new System.Windows.Forms.TextBox();
          this.faxLabel = new System.Windows.Forms.Label();
          this.homeLabel = new System.Windows.Forms.Label();
          this.statusTextBox = new System.Windows.Forms.TextBox();
          this.dataSet1 = new System.Data.DataSet();
          this.oleDbDataAdapter1 = new System.Data.OleDb.OleDbDataAdapter();
          this.oleDbDeleteCommand2 = new System.Data.OleDb.OleDbCommand();
          this.oleDbConnection1 = new System.Data.OleDb.OleDbConnection();
          this.oleDbInsertCommand2 = new System.Data.OleDb.OleDbCommand();
          this.oleDbSelectCommand2 = new System.Data.OleDb.OleDbCommand();
          this.oleDbUpdateCommand2 = new System.Data.OleDb.OleDbCommand();
          this.oleDbDeleteCommand1 = new System.Data.OleDb.OleDbCommand();
          this.oleDbInsertCommand1 = new System.Data.OleDb.OleDbCommand();
          this.oleDbSelectCommand1 = new System.Data.OleDb.OleDbCommand();
          this.oleDbUpdateCommand1 = new System.Data.OleDb.OleDbCommand();
          ((System.ComponentModel.ISupportInitialize)(this.dataSet1)).BeginInit();
          this.SuspendLayout();
          // 
          // countryLabel
          // 
          this.countryLabel.Location = new System.Drawing.Point(16, 264);
          this.countryLabel.Name = "countryLabel";
          this.countryLabel.Size = new System.Drawing.Size(152, 16);
          this.countryLabel.TabIndex = 6;
          this.countryLabel.Text = "Country:";
          this.countryLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
          // 
          // emailLabel
          // 
          this.emailLabel.Location = new System.Drawing.Point(16, 296);
          this.emailLabel.Name = "emailLabel";
          this.emailLabel.Size = new System.Drawing.Size(152, 16);
          this.emailLabel.TabIndex = 6;
          this.emailLabel.Text = "Email:";
          this.emailLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
          // 
          // addressLabel
          // 
          this.addressLabel.Location = new System.Drawing.Point(16, 136);
          this.addressLabel.Name = "addressLabel";
          this.addressLabel.Size = new System.Drawing.Size(152, 16);
          this.addressLabel.TabIndex = 6;
          this.addressLabel.Text = "Address:";
          this.addressLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
          // 
          // cityLabel
          // 
          this.cityLabel.Location = new System.Drawing.Point(16, 168);
          this.cityLabel.Name = "cityLabel";
          this.cityLabel.Size = new System.Drawing.Size(152, 16);
          this.cityLabel.TabIndex = 6;
          this.cityLabel.Text = "City:";
          this.cityLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
          // 
          // stateLabel
          // 
          this.stateLabel.Location = new System.Drawing.Point(16, 200);
          this.stateLabel.Name = "stateLabel";
          this.stateLabel.Size = new System.Drawing.Size(152, 16);
          this.stateLabel.TabIndex = 6;
          this.stateLabel.Text = "State/Province:";
          this.stateLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
          // 
          // faxTextBox
          // 
          this.faxTextBox.Location = new System.Drawing.Point(184, 360);
          this.faxTextBox.Name = "faxTextBox";
          this.faxTextBox.Size = new System.Drawing.Size(176, 20);
          this.faxTextBox.TabIndex = 5;
          // 
          // homeTextBox
          // 
          this.homeTextBox.Location = new System.Drawing.Point(184, 328);
          this.homeTextBox.Name = "homeTextBox";
          this.homeTextBox.Size = new System.Drawing.Size(176, 20);
          this.homeTextBox.TabIndex = 5;
          // 
          // idLabel
          // 
          this.idLabel.Location = new System.Drawing.Point(16, 40);
          this.idLabel.Name = "idLabel";
          this.idLabel.Size = new System.Drawing.Size(152, 16);
          this.idLabel.TabIndex = 6;
          this.idLabel.Text = "ID Number:";
          this.idLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
          // 
          // firstLabel
          // 
          this.firstLabel.Location = new System.Drawing.Point(16, 72);
          this.firstLabel.Name = "firstLabel";

⌨️ 快捷键说明

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