📄 addressbook.cs
字号:
// 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()
{
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";
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -