tcgl.cs
上传用户:fuyouda
上传日期:2021-03-17
资源大小:8619k
文件大小:7k
源码类别:

Windows编程

开发平台:

C/C++

  1. using System;
  2. using System.Drawing;
  3. using System.Collections;
  4. using System.ComponentModel;
  5. using System.Windows.Forms;
  6. using System.Data;
  7. using System.Data.OleDb;
  8. namespace WindowsApplication1
  9. {
  10. /// <summary>
  11. /// tcgl 的摘要说明。
  12. /// </summary>
  13. public class tcgl : System.Windows.Forms.Form
  14. {
  15. private System.Windows.Forms.Button button1;
  16. private System.Windows.Forms.Button button2;
  17. private System.Windows.Forms.Panel panel1;
  18. private System.Windows.Forms.TextBox textBox4;
  19. private System.Windows.Forms.Label label4;
  20. private System.Windows.Forms.TextBox textBox3;
  21. private System.Windows.Forms.Label label3;
  22. private System.Windows.Forms.TextBox textBox2;
  23. private System.Windows.Forms.Label label2;
  24. private System.Windows.Forms.TextBox textBox1;
  25. private System.Windows.Forms.Label label1;
  26. /// <summary>
  27. /// 必需的设计器变量。
  28. /// </summary>
  29. private System.ComponentModel.Container components = null;
  30. public tcgl()
  31. {
  32. //
  33. // Windows 窗体设计器支持所必需的
  34. //
  35. InitializeComponent();
  36. //
  37. // TODO: 在 InitializeComponent 调用后添加任何构造函数代码
  38. //
  39. }
  40. /// <summary>
  41. /// 清理所有正在使用的资源。
  42. /// </summary>
  43. protected override void Dispose( bool disposing )
  44. {
  45. if( disposing )
  46. {
  47. if(components != null)
  48. {
  49. components.Dispose();
  50. }
  51. }
  52. base.Dispose( disposing );
  53. }
  54. #region Windows 窗体设计器生成的代码
  55. /// <summary>
  56. /// 设计器支持所需的方法 - 不要使用代码编辑器修改
  57. /// 此方法的内容。
  58. /// </summary>
  59. private void InitializeComponent()
  60. {
  61. System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(tcgl));
  62. this.button1 = new System.Windows.Forms.Button();
  63. this.button2 = new System.Windows.Forms.Button();
  64. this.panel1 = new System.Windows.Forms.Panel();
  65. this.textBox4 = new System.Windows.Forms.TextBox();
  66. this.label4 = new System.Windows.Forms.Label();
  67. this.textBox3 = new System.Windows.Forms.TextBox();
  68. this.label3 = new System.Windows.Forms.Label();
  69. this.textBox2 = new System.Windows.Forms.TextBox();
  70. this.label2 = new System.Windows.Forms.Label();
  71. this.textBox1 = new System.Windows.Forms.TextBox();
  72. this.label1 = new System.Windows.Forms.Label();
  73. this.panel1.SuspendLayout();
  74. this.SuspendLayout();
  75. // 
  76. // button1
  77. // 
  78. this.button1.BackColor = System.Drawing.Color.Transparent;
  79. this.button1.Location = new System.Drawing.Point(56, 152);
  80. this.button1.Name = "button1";
  81. this.button1.Size = new System.Drawing.Size(72, 28);
  82. this.button1.TabIndex = 8;
  83. this.button1.Text = "添  加";
  84. this.button1.Click += new System.EventHandler(this.button1_Click);
  85. // 
  86. // button2
  87. // 
  88. this.button2.BackColor = System.Drawing.Color.Transparent;
  89. this.button2.Location = new System.Drawing.Point(232, 152);
  90. this.button2.Name = "button2";
  91. this.button2.Size = new System.Drawing.Size(72, 28);
  92. this.button2.TabIndex = 9;
  93. this.button2.Text = "取  消";
  94. this.button2.Click += new System.EventHandler(this.button2_Click);
  95. // 
  96. // panel1
  97. // 
  98. this.panel1.BackColor = System.Drawing.Color.Transparent;
  99. this.panel1.Controls.Add(this.textBox4);
  100. this.panel1.Controls.Add(this.label4);
  101. this.panel1.Controls.Add(this.textBox3);
  102. this.panel1.Controls.Add(this.label3);
  103. this.panel1.Controls.Add(this.textBox2);
  104. this.panel1.Controls.Add(this.label2);
  105. this.panel1.Controls.Add(this.textBox1);
  106. this.panel1.Controls.Add(this.label1);
  107. this.panel1.Location = new System.Drawing.Point(8, 8);
  108. this.panel1.Name = "panel1";
  109. this.panel1.Size = new System.Drawing.Size(320, 136);
  110. this.panel1.TabIndex = 10;
  111. // 
  112. // textBox4
  113. // 
  114. this.textBox4.Location = new System.Drawing.Point(184, 106);
  115. this.textBox4.Name = "textBox4";
  116. this.textBox4.Size = new System.Drawing.Size(120, 21);
  117. this.textBox4.TabIndex = 15;
  118. this.textBox4.Text = "";
  119. // 
  120. // label4
  121. // 
  122. this.label4.Location = new System.Drawing.Point(185, 81);
  123. this.label4.Name = "label4";
  124. this.label4.Size = new System.Drawing.Size(72, 16);
  125. this.label4.TabIndex = 14;
  126. this.label4.Text = "实际收费:";
  127. // 
  128. // textBox3
  129. // 
  130. this.textBox3.Location = new System.Drawing.Point(184, 34);
  131. this.textBox3.Name = "textBox3";
  132. this.textBox3.Size = new System.Drawing.Size(120, 21);
  133. this.textBox3.TabIndex = 13;
  134. this.textBox3.Text = "";
  135. // 
  136. // label3
  137. // 
  138. this.label3.Location = new System.Drawing.Point(184, 10);
  139. this.label3.Name = "label3";
  140. this.label3.Size = new System.Drawing.Size(72, 16);
  141. this.label3.TabIndex = 12;
  142. this.label3.Text = "入场时间:";
  143. // 
  144. // textBox2
  145. // 
  146. this.textBox2.Location = new System.Drawing.Point(24, 106);
  147. this.textBox2.Name = "textBox2";
  148. this.textBox2.Size = new System.Drawing.Size(120, 21);
  149. this.textBox2.TabIndex = 11;
  150. this.textBox2.Text = "";
  151. // 
  152. // label2
  153. // 
  154. this.label2.Location = new System.Drawing.Point(24, 82);
  155. this.label2.Name = "label2";
  156. this.label2.Size = new System.Drawing.Size(72, 16);
  157. this.label2.TabIndex = 10;
  158. this.label2.Text = "离场时间:";
  159. // 
  160. // textBox1
  161. // 
  162. this.textBox1.Location = new System.Drawing.Point(24, 34);
  163. this.textBox1.Name = "textBox1";
  164. this.textBox1.Size = new System.Drawing.Size(120, 21);
  165. this.textBox1.TabIndex = 9;
  166. this.textBox1.Text = "";
  167. // 
  168. // label1
  169. // 
  170. this.label1.Location = new System.Drawing.Point(24, 10);
  171. this.label1.Name = "label1";
  172. this.label1.Size = new System.Drawing.Size(72, 16);
  173. this.label1.TabIndex = 8;
  174. this.label1.Text = "停车编号:";
  175. // 
  176. // tcgl
  177. // 
  178. this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
  179. this.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("$this.BackgroundImage")));
  180. this.ClientSize = new System.Drawing.Size(336, 192);
  181. this.Controls.Add(this.panel1);
  182. this.Controls.Add(this.button2);
  183. this.Controls.Add(this.button1);
  184. this.Name = "tcgl";
  185. this.Load += new System.EventHandler(this.tcgl_Load);
  186. this.panel1.ResumeLayout(false);
  187. this.ResumeLayout(false);
  188. }
  189. #endregion
  190. private void tcgl_Load(object sender, System.EventArgs e)
  191. {
  192. }
  193. private void button1_Click(object sender, System.EventArgs e)
  194. {
  195. try
  196. {
  197. string connstr="Provider=Microsoft.jet.oledb.4.0;data source="+Application.StartupPath+"\xqwy.mdb";
  198. OleDbConnection conn=new OleDbConnection(connstr);
  199. conn.Open();
  200. 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()+"')";
  201. OleDbCommand cmd=new OleDbCommand(StrSQL,conn);
  202. cmd.ExecuteNonQuery();
  203. MessageBox.Show("增加数据集记录操作成功!","信息提示",MessageBoxButtons.OK,MessageBoxIcon.Information);
  204. }
  205. catch(Exception Err)
  206. {
  207. MessageBox.Show("增加数据集记录操作失败:"+Err.Message,"信息提示",MessageBoxButtons.OK,MessageBoxIcon.Information);
  208. }
  209. }
  210. private void button2_Click(object sender, System.EventArgs e)
  211. {
  212. Application.Exit();
  213. }
  214. }
  215. }