tctj.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. /// tctj 的摘要说明。
  12. /// </summary>
  13. public class tctj : System.Windows.Forms.Form
  14. {
  15. private System.Windows.Forms.Button button1;
  16. private System.Windows.Forms.Button button2;
  17. private System.Windows.Forms.DataGrid dataGrid1;
  18. private System.Windows.Forms.StatusBar statusBar1;
  19. private System.Windows.Forms.StatusBarPanel statusBarPanel1;
  20. private System.Windows.Forms.StatusBarPanel statusBarPanel2;
  21. private System.Windows.Forms.Label label1;
  22. private System.Windows.Forms.TextBox textBox1;
  23. private System.Windows.Forms.Panel panel1;
  24. /// <summary>
  25. /// 必需的设计器变量。
  26. /// </summary>
  27. private System.ComponentModel.Container components = null;
  28. public tctj()
  29. {
  30. //
  31. // Windows 窗体设计器支持所必需的
  32. //
  33. InitializeComponent();
  34. //
  35. // TODO: 在 InitializeComponent 调用后添加任何构造函数代码
  36. //
  37. }
  38. /// <summary>
  39. /// 清理所有正在使用的资源。
  40. /// </summary>
  41. protected override void Dispose( bool disposing )
  42. {
  43. if( disposing )
  44. {
  45. if(components != null)
  46. {
  47. components.Dispose();
  48. }
  49. }
  50. base.Dispose( disposing );
  51. }
  52. #region Windows 窗体设计器生成的代码
  53. /// <summary>
  54. /// 设计器支持所需的方法 - 不要使用代码编辑器修改
  55. /// 此方法的内容。
  56. /// </summary>
  57. private void InitializeComponent()
  58. {
  59. System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(tctj));
  60. this.button1 = new System.Windows.Forms.Button();
  61. this.button2 = new System.Windows.Forms.Button();
  62. this.dataGrid1 = new System.Windows.Forms.DataGrid();
  63. this.statusBar1 = new System.Windows.Forms.StatusBar();
  64. this.statusBarPanel1 = new System.Windows.Forms.StatusBarPanel();
  65. this.statusBarPanel2 = new System.Windows.Forms.StatusBarPanel();
  66. this.label1 = new System.Windows.Forms.Label();
  67. this.textBox1 = new System.Windows.Forms.TextBox();
  68. this.panel1 = new System.Windows.Forms.Panel();
  69. ((System.ComponentModel.ISupportInitialize)(this.dataGrid1)).BeginInit();
  70. ((System.ComponentModel.ISupportInitialize)(this.statusBarPanel1)).BeginInit();
  71. ((System.ComponentModel.ISupportInitialize)(this.statusBarPanel2)).BeginInit();
  72. this.panel1.SuspendLayout();
  73. this.SuspendLayout();
  74. // 
  75. // button1
  76. // 
  77. this.button1.BackColor = System.Drawing.Color.Transparent;
  78. this.button1.Location = new System.Drawing.Point(250, 15);
  79. this.button1.Name = "button1";
  80. this.button1.Size = new System.Drawing.Size(72, 28);
  81. this.button1.TabIndex = 4;
  82. this.button1.Text = "查询";
  83. this.button1.Click += new System.EventHandler(this.button1_Click);
  84. // 
  85. // button2
  86. // 
  87. this.button2.BackColor = System.Drawing.Color.Transparent;
  88. this.button2.Location = new System.Drawing.Point(338, 15);
  89. this.button2.Name = "button2";
  90. this.button2.Size = new System.Drawing.Size(72, 28);
  91. this.button2.TabIndex = 5;
  92. this.button2.Text = "取消";
  93. this.button2.Click += new System.EventHandler(this.button2_Click);
  94. // 
  95. // dataGrid1
  96. // 
  97. this.dataGrid1.DataMember = "";
  98. this.dataGrid1.HeaderForeColor = System.Drawing.SystemColors.ControlText;
  99. this.dataGrid1.Location = new System.Drawing.Point(40, 80);
  100. this.dataGrid1.Name = "dataGrid1";
  101. this.dataGrid1.Size = new System.Drawing.Size(432, 344);
  102. this.dataGrid1.TabIndex = 6;
  103. // 
  104. // statusBar1
  105. // 
  106. this.statusBar1.Location = new System.Drawing.Point(0, 432);
  107. this.statusBar1.Name = "statusBar1";
  108. this.statusBar1.Panels.AddRange(new System.Windows.Forms.StatusBarPanel[] {
  109.   this.statusBarPanel1,
  110.   this.statusBarPanel2});
  111. this.statusBar1.ShowPanels = true;
  112. this.statusBar1.Size = new System.Drawing.Size(616, 24);
  113. this.statusBar1.TabIndex = 7;
  114. this.statusBar1.Text = "statusBar1";
  115. // 
  116. // statusBarPanel1
  117. // 
  118. this.statusBarPanel1.Text = "合计记录数:";
  119. // 
  120. // statusBarPanel2
  121. // 
  122. this.statusBarPanel2.Text = "合计金额:";
  123. // 
  124. // label1
  125. // 
  126. this.label1.BackColor = System.Drawing.Color.Transparent;
  127. this.label1.Location = new System.Drawing.Point(42, 21);
  128. this.label1.Name = "label1";
  129. this.label1.Size = new System.Drawing.Size(72, 16);
  130. this.label1.TabIndex = 8;
  131. this.label1.Text = "停车编号:";
  132. // 
  133. // textBox1
  134. // 
  135. this.textBox1.Location = new System.Drawing.Point(114, 15);
  136. this.textBox1.Name = "textBox1";
  137. this.textBox1.Size = new System.Drawing.Size(120, 21);
  138. this.textBox1.TabIndex = 9;
  139. this.textBox1.Text = "";
  140. // 
  141. // panel1
  142. // 
  143. this.panel1.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("panel1.BackgroundImage")));
  144. this.panel1.Controls.Add(this.textBox1);
  145. this.panel1.Controls.Add(this.label1);
  146. this.panel1.Controls.Add(this.button2);
  147. this.panel1.Controls.Add(this.button1);
  148. this.panel1.Location = new System.Drawing.Point(39, 28);
  149. this.panel1.Name = "panel1";
  150. this.panel1.Size = new System.Drawing.Size(432, 52);
  151. this.panel1.TabIndex = 10;
  152. // 
  153. // tctj
  154. // 
  155. this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
  156. this.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("$this.BackgroundImage")));
  157. this.ClientSize = new System.Drawing.Size(616, 456);
  158. this.Controls.Add(this.panel1);
  159. this.Controls.Add(this.statusBar1);
  160. this.Controls.Add(this.dataGrid1);
  161. this.Name = "tctj";
  162. this.Text = "停车统计查询";
  163. this.Load += new System.EventHandler(this.tctj_Load);
  164. ((System.ComponentModel.ISupportInitialize)(this.dataGrid1)).EndInit();
  165. ((System.ComponentModel.ISupportInitialize)(this.statusBarPanel1)).EndInit();
  166. ((System.ComponentModel.ISupportInitialize)(this.statusBarPanel2)).EndInit();
  167. this.panel1.ResumeLayout(false);
  168. this.ResumeLayout(false);
  169. }
  170. #endregion
  171. private void button1_Click(object sender, System.EventArgs e)
  172. {
  173. try
  174. {
  175. string connstr,StrSQL;
  176. connstr="Provider=Microsoft.jet.oledb.4.0;data source="+Application.StartupPath+"\xqwy.mdb";
  177. StrSQL="SELECT * FROM tcb WHERE Id='"+this.textBox1.Text.Trim()+"'";
  178. OleDbConnection conn=new OleDbConnection(connstr);
  179. conn.Open();
  180. OleDbDataAdapter da=new OleDbDataAdapter(StrSQL,conn);
  181. DataSet ds=new DataSet();
  182. da.Fill(ds,"tcb");
  183. DataTable mytable=new DataTable();
  184. mytable=ds.Tables[0];
  185. this.dataGrid1.DataSource=mytable;
  186. //OleDbCommandBuilder cmdbld=new OleDbCommandBuilder(da);
  187. //da.Update(mytable);
  188. }
  189. catch(Exception Err)
  190. {
  191. MessageBox.Show("查询数据集记录操作失败:"+Err.Message,"信息提示",
  192. MessageBoxButtons.OK,MessageBoxIcon.Information);
  193. }
  194. }
  195. private void tctj_Load(object sender, System.EventArgs e)
  196. {
  197. }
  198. private void button2_Click(object sender, System.EventArgs e)
  199. {
  200. Application.Exit();
  201. }
  202. }
  203. }