📄 tcgl.cs
字号:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Data.OleDb;
namespace WindowsApplication1
{
/// <summary>
/// tcgl 的摘要说明。
/// </summary>
public class tcgl : System.Windows.Forms.Form
{
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.TextBox textBox4;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.TextBox textBox3;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.TextBox textBox2;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.Label label1;
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.Container components = null;
public tcgl()
{
//
// 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(tcgl));
this.button1 = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
this.panel1 = new System.Windows.Forms.Panel();
this.textBox4 = new System.Windows.Forms.TextBox();
this.label4 = new System.Windows.Forms.Label();
this.textBox3 = new System.Windows.Forms.TextBox();
this.label3 = new System.Windows.Forms.Label();
this.textBox2 = new System.Windows.Forms.TextBox();
this.label2 = new System.Windows.Forms.Label();
this.textBox1 = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.panel1.SuspendLayout();
this.SuspendLayout();
//
// button1
//
this.button1.BackColor = System.Drawing.Color.Transparent;
this.button1.Location = new System.Drawing.Point(56, 152);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(72, 28);
this.button1.TabIndex = 8;
this.button1.Text = "添 加";
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// button2
//
this.button2.BackColor = System.Drawing.Color.Transparent;
this.button2.Location = new System.Drawing.Point(232, 152);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(72, 28);
this.button2.TabIndex = 9;
this.button2.Text = "取 消";
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// panel1
//
this.panel1.BackColor = System.Drawing.Color.Transparent;
this.panel1.Controls.Add(this.textBox4);
this.panel1.Controls.Add(this.label4);
this.panel1.Controls.Add(this.textBox3);
this.panel1.Controls.Add(this.label3);
this.panel1.Controls.Add(this.textBox2);
this.panel1.Controls.Add(this.label2);
this.panel1.Controls.Add(this.textBox1);
this.panel1.Controls.Add(this.label1);
this.panel1.Location = new System.Drawing.Point(8, 8);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(320, 136);
this.panel1.TabIndex = 10;
//
// textBox4
//
this.textBox4.Location = new System.Drawing.Point(184, 106);
this.textBox4.Name = "textBox4";
this.textBox4.Size = new System.Drawing.Size(120, 21);
this.textBox4.TabIndex = 15;
this.textBox4.Text = "";
//
// label4
//
this.label4.Location = new System.Drawing.Point(185, 81);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(72, 16);
this.label4.TabIndex = 14;
this.label4.Text = "实际收费:";
//
// textBox3
//
this.textBox3.Location = new System.Drawing.Point(184, 34);
this.textBox3.Name = "textBox3";
this.textBox3.Size = new System.Drawing.Size(120, 21);
this.textBox3.TabIndex = 13;
this.textBox3.Text = "";
//
// label3
//
this.label3.Location = new System.Drawing.Point(184, 10);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(72, 16);
this.label3.TabIndex = 12;
this.label3.Text = "入场时间:";
//
// textBox2
//
this.textBox2.Location = new System.Drawing.Point(24, 106);
this.textBox2.Name = "textBox2";
this.textBox2.Size = new System.Drawing.Size(120, 21);
this.textBox2.TabIndex = 11;
this.textBox2.Text = "";
//
// label2
//
this.label2.Location = new System.Drawing.Point(24, 82);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(72, 16);
this.label2.TabIndex = 10;
this.label2.Text = "离场时间:";
//
// textBox1
//
this.textBox1.Location = new System.Drawing.Point(24, 34);
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(120, 21);
this.textBox1.TabIndex = 9;
this.textBox1.Text = "";
//
// label1
//
this.label1.Location = new System.Drawing.Point(24, 10);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(72, 16);
this.label1.TabIndex = 8;
this.label1.Text = "停车编号:";
//
// tcgl
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("$this.BackgroundImage")));
this.ClientSize = new System.Drawing.Size(336, 192);
this.Controls.Add(this.panel1);
this.Controls.Add(this.button2);
this.Controls.Add(this.button1);
this.Name = "tcgl";
this.Load += new System.EventHandler(this.tcgl_Load);
this.panel1.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private void tcgl_Load(object sender, System.EventArgs e)
{
}
private void button1_Click(object sender, System.EventArgs e)
{
try
{
string connstr="Provider=Microsoft.jet.oledb.4.0;data source="+Application.StartupPath+"\\xqwy.mdb";
OleDbConnection conn=new OleDbConnection(connstr);
conn.Open();
string StrSQL="INSERT INTO tcb (Id,Rcsj,Lcsj,Sjsf)VALUES('"+this.textBox1.Text.Trim()+"','"+this.textBox3.Text.Trim()+"','"+this.textBox2.Text.Trim()+"','"+this.textBox4.Text.Trim()+"')";
OleDbCommand cmd=new OleDbCommand(StrSQL,conn);
cmd.ExecuteNonQuery();
MessageBox.Show("增加数据集记录操作成功!","信息提示",MessageBoxButtons.OK,MessageBoxIcon.Information);
}
catch(Exception Err)
{
MessageBox.Show("增加数据集记录操作失败:"+Err.Message,"信息提示",MessageBoxButtons.OK,MessageBoxIcon.Information);
}
}
private void button2_Click(object sender, System.EventArgs e)
{
Application.Exit();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -