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

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. /// userg1 的摘要说明。
  12. /// </summary>
  13. public class userg1 : System.Windows.Forms.Form
  14. {
  15. private System.Windows.Forms.TabControl tabControl1;
  16. private System.Windows.Forms.TabPage tabPage1;
  17. private System.Windows.Forms.TabPage tabPage2;
  18. private System.Windows.Forms.Panel panel1;
  19. private System.Windows.Forms.Label label2;
  20. private System.Windows.Forms.Label label3;
  21. private System.Windows.Forms.TextBox textBox2;
  22. private System.Windows.Forms.TextBox textBox3;
  23. private System.Windows.Forms.DataGrid dataGrid1;
  24. private System.Windows.Forms.Button button11;
  25. private System.Windows.Forms.Button button12;
  26. private System.Windows.Forms.Button button13;
  27. private System.Windows.Forms.Button button14;
  28. private System.Windows.Forms.Button button15;
  29. private System.Windows.Forms.Button button16;
  30. private System.Windows.Forms.Button button17;
  31. private System.Windows.Forms.Button button18;
  32. private System.Windows.Forms.Button button19;
  33. private System.Windows.Forms.Button button1;
  34. private System.Windows.Forms.Button button5;
  35. private System.Windows.Forms.Button button6;
  36. private System.Windows.Forms.Button button7;
  37. private System.Windows.Forms.Button button8;
  38. //private System.Data.OleDb.OleDbDataAdapter oleDbDataAdapter1;
  39. //private System.Data.DataSet dataSet1;
  40. private BindingManagerBase MyBind;
  41. private System.Windows.Forms.Label label1;
  42. /// <summary>
  43. /// 必需的设计器变量。
  44. /// </summary>
  45. private System.ComponentModel.Container components = null;
  46. public userg1()
  47. {
  48. //
  49. // Windows 窗体设计器支持所必需的
  50. //
  51. InitializeComponent();
  52. //
  53. // TODO: 在 InitializeComponent 调用后添加任何构造函数代码
  54. //
  55. }
  56. /// <summary>
  57. /// 清理所有正在使用的资源。
  58. /// </summary>
  59. protected override void Dispose( bool disposing )
  60. {
  61. if( disposing )
  62. {
  63. if(components != null)
  64. {
  65. components.Dispose();
  66. }
  67. }
  68. base.Dispose( disposing );
  69. }
  70. #region Windows 窗体设计器生成的代码
  71. /// <summary>
  72. /// 设计器支持所需的方法 - 不要使用代码编辑器修改
  73. /// 此方法的内容。
  74. /// </summary>
  75. private void InitializeComponent()
  76. {
  77. System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(userg1));
  78. this.tabControl1 = new System.Windows.Forms.TabControl();
  79. this.tabPage1 = new System.Windows.Forms.TabPage();
  80. this.dataGrid1 = new System.Windows.Forms.DataGrid();
  81. this.panel1 = new System.Windows.Forms.Panel();
  82. this.button1 = new System.Windows.Forms.Button();
  83. this.button5 = new System.Windows.Forms.Button();
  84. this.button6 = new System.Windows.Forms.Button();
  85. this.button7 = new System.Windows.Forms.Button();
  86. this.button8 = new System.Windows.Forms.Button();
  87. this.tabPage2 = new System.Windows.Forms.TabPage();
  88. this.button11 = new System.Windows.Forms.Button();
  89. this.button12 = new System.Windows.Forms.Button();
  90. this.button13 = new System.Windows.Forms.Button();
  91. this.button14 = new System.Windows.Forms.Button();
  92. this.button15 = new System.Windows.Forms.Button();
  93. this.button16 = new System.Windows.Forms.Button();
  94. this.button17 = new System.Windows.Forms.Button();
  95. this.button18 = new System.Windows.Forms.Button();
  96. this.button19 = new System.Windows.Forms.Button();
  97. this.textBox3 = new System.Windows.Forms.TextBox();
  98. this.textBox2 = new System.Windows.Forms.TextBox();
  99. this.label3 = new System.Windows.Forms.Label();
  100. this.label2 = new System.Windows.Forms.Label();
  101. this.label1 = new System.Windows.Forms.Label();
  102. this.tabControl1.SuspendLayout();
  103. this.tabPage1.SuspendLayout();
  104. ((System.ComponentModel.ISupportInitialize)(this.dataGrid1)).BeginInit();
  105. this.panel1.SuspendLayout();
  106. this.tabPage2.SuspendLayout();
  107. this.SuspendLayout();
  108. // 
  109. // tabControl1
  110. // 
  111. this.tabControl1.Controls.Add(this.tabPage1);
  112. this.tabControl1.Controls.Add(this.tabPage2);
  113. this.tabControl1.Location = new System.Drawing.Point(0, 0);
  114. this.tabControl1.Name = "tabControl1";
  115. this.tabControl1.SelectedIndex = 0;
  116. this.tabControl1.Size = new System.Drawing.Size(520, 376);
  117. this.tabControl1.TabIndex = 0;
  118. this.tabControl1.SelectedIndexChanged += new System.EventHandler(this.tabControl1_SelectedIndexChanged);
  119. // 
  120. // tabPage1
  121. // 
  122. this.tabPage1.Controls.Add(this.dataGrid1);
  123. this.tabPage1.Controls.Add(this.panel1);
  124. this.tabPage1.Location = new System.Drawing.Point(4, 21);
  125. this.tabPage1.Name = "tabPage1";
  126. this.tabPage1.Size = new System.Drawing.Size(512, 351);
  127. this.tabPage1.TabIndex = 0;
  128. this.tabPage1.Text = "多行显示";
  129. // 
  130. // dataGrid1
  131. // 
  132. this.dataGrid1.DataMember = "";
  133. this.dataGrid1.HeaderForeColor = System.Drawing.SystemColors.ControlText;
  134. this.dataGrid1.Location = new System.Drawing.Point(8, 0);
  135. this.dataGrid1.Name = "dataGrid1";
  136. this.dataGrid1.Size = new System.Drawing.Size(464, 208);
  137. this.dataGrid1.TabIndex = 1;
  138. // 
  139. // panel1
  140. // 
  141. this.panel1.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
  142. this.panel1.Controls.Add(this.button1);
  143. this.panel1.Controls.Add(this.button5);
  144. this.panel1.Controls.Add(this.button6);
  145. this.panel1.Controls.Add(this.button7);
  146. this.panel1.Controls.Add(this.button8);
  147. this.panel1.Location = new System.Drawing.Point(0, 208);
  148. this.panel1.Name = "panel1";
  149. this.panel1.Size = new System.Drawing.Size(472, 72);
  150. this.panel1.TabIndex = 0;
  151. this.panel1.Paint += new System.Windows.Forms.PaintEventHandler(this.panel1_Paint);
  152. // 
  153. // button1
  154. // 
  155. this.button1.BackColor = System.Drawing.Color.Transparent;
  156. this.button1.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("button1.BackgroundImage")));
  157. this.button1.Location = new System.Drawing.Point(360, 8);
  158. this.button1.Name = "button1";
  159. this.button1.TabIndex = 30;
  160. this.button1.Text = "关闭程序";
  161. this.button1.Click += new System.EventHandler(this.button1_Click);
  162. // 
  163. // button5
  164. // 
  165. this.button5.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("button5.BackgroundImage")));
  166. this.button5.Location = new System.Drawing.Point(280, 8);
  167. this.button5.Name = "button5";
  168. this.button5.TabIndex = 26;
  169. this.button5.Text = "末一条记录";
  170. this.button5.Click += new System.EventHandler(this.button5_Click);
  171. // 
  172. // button6
  173. // 
  174. this.button6.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("button6.BackgroundImage")));
  175. this.button6.Location = new System.Drawing.Point(192, 8);
  176. this.button6.Name = "button6";
  177. this.button6.TabIndex = 25;
  178. this.button6.Text = "后一条记录";
  179. this.button6.Click += new System.EventHandler(this.button6_Click);
  180. // 
  181. // button7
  182. // 
  183. this.button7.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("button7.BackgroundImage")));
  184. this.button7.Location = new System.Drawing.Point(104, 8);
  185. this.button7.Name = "button7";
  186. this.button7.TabIndex = 23;
  187. this.button7.Text = "前一条记录";
  188. this.button7.Click += new System.EventHandler(this.button7_Click);
  189. // 
  190. // button8
  191. // 
  192. this.button8.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("button8.BackgroundImage")));
  193. this.button8.Location = new System.Drawing.Point(16, 8);
  194. this.button8.Name = "button8";
  195. this.button8.TabIndex = 22;
  196. this.button8.Text = "第一条记录";
  197. this.button8.Click += new System.EventHandler(this.button8_Click);
  198. // 
  199. // tabPage2
  200. // 
  201. this.tabPage2.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("tabPage2.BackgroundImage")));
  202. this.tabPage2.Controls.Add(this.button11);
  203. this.tabPage2.Controls.Add(this.button12);
  204. this.tabPage2.Controls.Add(this.button13);
  205. this.tabPage2.Controls.Add(this.button14);
  206. this.tabPage2.Controls.Add(this.button15);
  207. this.tabPage2.Controls.Add(this.button16);
  208. this.tabPage2.Controls.Add(this.button17);
  209. this.tabPage2.Controls.Add(this.button18);
  210. this.tabPage2.Controls.Add(this.button19);
  211. this.tabPage2.Controls.Add(this.textBox3);
  212. this.tabPage2.Controls.Add(this.textBox2);
  213. this.tabPage2.Controls.Add(this.label3);
  214. this.tabPage2.Controls.Add(this.label2);
  215. this.tabPage2.Location = new System.Drawing.Point(4, 21);
  216. this.tabPage2.Name = "tabPage2";
  217. this.tabPage2.Size = new System.Drawing.Size(512, 351);
  218. this.tabPage2.TabIndex = 1;
  219. this.tabPage2.Text = "单框显示";
  220. this.tabPage2.Click += new System.EventHandler(this.tabPage2_Click);
  221. // 
  222. // button11
  223. // 
  224. this.button11.BackColor = System.Drawing.Color.Transparent;
  225. this.button11.Location = new System.Drawing.Point(344, 208);
  226. this.button11.Name = "button11";
  227. this.button11.TabIndex = 21;
  228. this.button11.Text = "关闭程序";
  229. this.button11.Click += new System.EventHandler(this.button11_Click);
  230. // 
  231. // button12
  232. // 
  233. this.button12.BackColor = System.Drawing.Color.Transparent;
  234. this.button12.Location = new System.Drawing.Point(168, 208);
  235. this.button12.Name = "button12";
  236. this.button12.TabIndex = 20;
  237. this.button12.Text = "修改记录";
  238. this.button12.Click += new System.EventHandler(this.button12_Click);
  239. // 
  240. // button13
  241. // 
  242. this.button13.BackColor = System.Drawing.Color.Transparent;
  243. this.button13.Location = new System.Drawing.Point(344, 168);
  244. this.button13.Name = "button13";
  245. this.button13.TabIndex = 19;
  246. this.button13.Text = "增加记录";
  247. this.button13.Click += new System.EventHandler(this.button13_Click);
  248. // 
  249. // button14
  250. // 
  251. this.button14.BackColor = System.Drawing.Color.Transparent;
  252. this.button14.Location = new System.Drawing.Point(256, 168);
  253. this.button14.Name = "button14";
  254. this.button14.TabIndex = 18;
  255. this.button14.Text = "新建记录";
  256. this.button14.Click += new System.EventHandler(this.button14_Click);
  257. // 
  258. // button15
  259. // 
  260. this.button15.BackColor = System.Drawing.Color.Transparent;
  261. this.button15.Location = new System.Drawing.Point(168, 168);
  262. this.button15.Name = "button15";
  263. this.button15.TabIndex = 17;
  264. this.button15.Text = "末一条记录";
  265. this.button15.Click += new System.EventHandler(this.button15_Click);
  266. // 
  267. // button16
  268. // 
  269. this.button16.BackColor = System.Drawing.Color.Transparent;
  270. this.button16.Location = new System.Drawing.Point(344, 128);
  271. this.button16.Name = "button16";
  272. this.button16.TabIndex = 16;
  273. this.button16.Text = "后一条记录";
  274. this.button16.Click += new System.EventHandler(this.button16_Click);
  275. // 
  276. // button17
  277. // 
  278. this.button17.BackColor = System.Drawing.Color.Transparent;
  279. this.button17.Location = new System.Drawing.Point(256, 128);
  280. this.button17.Name = "button17";
  281. this.button17.TabIndex = 14;
  282. this.button17.Text = "前一条记录";
  283. this.button17.Click += new System.EventHandler(this.button17_Click);
  284. // 
  285. // button18
  286. // 
  287. this.button18.BackColor = System.Drawing.Color.Transparent;
  288. this.button18.Location = new System.Drawing.Point(168, 128);
  289. this.button18.Name = "button18";
  290. this.button18.TabIndex = 13;
  291. this.button18.Text = "第一条记录";
  292. this.button18.Click += new System.EventHandler(this.button18_Click);
  293. // 
  294. // button19
  295. // 
  296. this.button19.BackColor = System.Drawing.Color.Transparent;
  297. this.button19.Location = new System.Drawing.Point(256, 208);
  298. this.button19.Name = "button19";
  299. this.button19.TabIndex = 15;
  300. this.button19.Text = "删除记录";
  301. this.button19.Click += new System.EventHandler(this.button19_Click);
  302. // 
  303. // textBox3
  304. // 
  305. this.textBox3.Location = new System.Drawing.Point(96, 80);
  306. this.textBox3.Name = "textBox3";
  307. this.textBox3.Size = new System.Drawing.Size(120, 21);
  308. this.textBox3.TabIndex = 6;
  309. this.textBox3.Text = "";
  310. // 
  311. // textBox2
  312. // 
  313. this.textBox2.Location = new System.Drawing.Point(96, 24);
  314. this.textBox2.Name = "textBox2";
  315. this.textBox2.Size = new System.Drawing.Size(120, 21);
  316. this.textBox2.TabIndex = 5;
  317. this.textBox2.Text = "";
  318. // 
  319. // label3
  320. // 
  321. this.label3.BackColor = System.Drawing.Color.Transparent;
  322. this.label3.Location = new System.Drawing.Point(40, 87);
  323. this.label3.Name = "label3";
  324. this.label3.Size = new System.Drawing.Size(56, 16);
  325. this.label3.TabIndex = 2;
  326. this.label3.Text = "密  码:";
  327. // 
  328. // label2
  329. // 
  330. this.label2.BackColor = System.Drawing.Color.Transparent;
  331. this.label2.Location = new System.Drawing.Point(40, 31);
  332. this.label2.Name = "label2";
  333. this.label2.Size = new System.Drawing.Size(56, 16);
  334. this.label2.TabIndex = 1;
  335. this.label2.Text = "用户名:";
  336. // 
  337. // label1
  338. // 
  339. this.label1.Location = new System.Drawing.Point(544, 80);
  340. this.label1.Name = "label1";
  341. this.label1.Size = new System.Drawing.Size(152, 32);
  342. this.label1.TabIndex = 1;
  343. this.label1.Text = "label1";
  344. // 
  345. // userg1
  346. // 
  347. this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
  348. this.ClientSize = new System.Drawing.Size(480, 272);
  349. this.Controls.Add(this.label1);
  350. this.Controls.Add(this.tabControl1);
  351. this.Name = "userg1";
  352. this.Text = "用户管理";
  353. this.Load += new System.EventHandler(this.userg1_Load);
  354. this.tabControl1.ResumeLayout(false);
  355. this.tabPage1.ResumeLayout(false);
  356. ((System.ComponentModel.ISupportInitialize)(this.dataGrid1)).EndInit();
  357. this.panel1.ResumeLayout(false);
  358. this.tabPage2.ResumeLayout(false);
  359. this.ResumeLayout(false);
  360. }
  361. #endregion
  362. private void tabPage2_Click(object sender, System.EventArgs e)
  363. {
  364. }
  365. private void tabControl1_SelectedIndexChanged(object sender, System.EventArgs e)
  366. {
  367. }
  368. private void userg1_Load(object sender, System.EventArgs e)
  369. {
  370. string connstr,selectcmd;
  371. connstr="Provider=Microsoft.jet.oledb.4.0;data source="+Application.StartupPath+"\xqwy.mdb";
  372. selectcmd="select * from user1";
  373. OleDbConnection conn=new OleDbConnection(connstr);
  374. conn.Open();
  375. OleDbDataAdapter da=new OleDbDataAdapter(selectcmd,conn);
  376. //OleDbDataAdapter oleDbDataAdapter1=new OleDbDataAdapter(selectcmd,conn);
  377. DataSet ds=new DataSet();
  378. //DataSet dataSet1=new DataSet();
  379. da.Fill(ds);
  380. DataTable mytable=new DataTable();
  381. mytable=ds.Tables[0];
  382. //oleDbDataAdapter1.Fill(dataSet1);
  383. this.dataGrid1.DataSource=mytable;
  384. //conn.Close();
  385. try
  386. {
  387. //this.oleDbDataAdapter1.Fill(this.dataSet1,"user1");
  388. this.textBox2.DataBindings.Add("Text",mytable,"Name");
  389. this.textBox3.DataBindings.Add("Text",mytable,"Passwd");
  390. this.MyBind=this.dataGrid1.BindingContext[mytable];
  391. this.dataGrid1.Select(0);
  392. }
  393. catch(Exception Err)
  394. {
  395. MessageBox.Show("打开数据库表错误:"+Err.Message,"信息提示",MessageBoxButtons.OK,MessageBoxIcon.Information);
  396. return;
  397. }
  398. }
  399. private void button8_Click(object sender, System.EventArgs e)
  400. {
  401. //第一条记录
  402. this.dataGrid1.UnSelect(MyBind.Position);
  403. this.MyBind.Position=0;
  404. this.dataGrid1.Select(MyBind.Position);
  405. }
  406. private void button7_Click(object sender, System.EventArgs e)
  407. {
  408. //前一条记录
  409. if(this.MyBind.Position==0)
  410. {
  411. MessageBox.Show("已经是第一条记录","信息提示",MessageBoxButtons.OK,MessageBoxIcon.Information);
  412. return;
  413. }
  414. else
  415. {
  416. this.dataGrid1.UnSelect(MyBind.Position);
  417. this.MyBind.Position--;
  418. this.dataGrid1.Select(MyBind.Position);
  419. }
  420. }
  421. private void button6_Click(object sender, System.EventArgs e)
  422. {
  423. //后一条记录
  424. if(this.MyBind.Position==this.MyBind.Count-1)
  425. {
  426. MessageBox.Show("已经是末一条记录","信息提示",MessageBoxButtons.OK,MessageBoxIcon.Information);
  427. return;
  428. }
  429. else
  430. {
  431. this.dataGrid1.UnSelect(MyBind.Position);
  432. this.MyBind.Position++;
  433. this.dataGrid1.Select(MyBind.Position);
  434. this.label1.Text=MyBind.Count.ToString();
  435. }
  436. }
  437. private void button5_Click(object sender, System.EventArgs e)
  438. {
  439. //末一条记录
  440. this.dataGrid1.UnSelect(MyBind.Position);
  441. this.MyBind.Position=this.MyBind.Count-1;
  442. this.dataGrid1.Select(this.MyBind.Position);
  443. }
  444. private void button4_Click(object sender, System.EventArgs e)
  445. {
  446. //新建记录
  447. }
  448. private void button18_Click(object sender, System.EventArgs e)
  449. {
  450. this.MyBind.Position=0;
  451. }
  452. private void button17_Click(object sender, System.EventArgs e)
  453. {
  454. this.MyBind.Position--;
  455. }
  456. private void button16_Click(object sender, System.EventArgs e)
  457. {
  458. this.MyBind.Position++;
  459. }
  460. private void button15_Click(object sender, System.EventArgs e)
  461. {
  462. this.MyBind.Position=this.MyBind.Count-1;
  463. }
  464. private void button14_Click(object sender, System.EventArgs e)
  465. {
  466. this.textBox2.Text="";
  467. this.textBox3.Text="";
  468. }
  469. private void button13_Click(object sender, System.EventArgs e)
  470. {
  471. //增加记录
  472. if(this.textBox2.Text.Length<1|this.textBox3.Text.Length<1)
  473. {
  474. MessageBox.Show("客户所有信息必须填写!","信息提示",MessageBoxButtons.OK,MessageBoxIcon.Information);
  475. return;
  476. }
  477. try
  478. {
  479. string connstr="Provider=Microsoft.jet.oledb.4.0;data source="+Application.StartupPath+"\xqwy.mdb";
  480. OleDbConnection conn=new OleDbConnection(connstr);
  481. conn.Open();
  482. string StrSQL="INSERT INTO user1(Name,Passwd)VALUES('"+this.textBox2.Text.Trim()+"','"+this.textBox3.Text.Trim()+"')";
  483. //sring strsql="select * from***"
  484. /*OleDbDataAdapter da1=new OleDbDataAdapter(StrSQL,conn);
  485. DataSet ds1=new DataSet();
  486. da1.Fill(ds1);
  487. DataTable mytable1=new DataTable();
  488. DataRow newrow=myatble.newrow()
  489. newrow[0=
  490. mytable[1,2]
  491. mytable.add(datarow)
  492. mytable1=ds1.Tables[0];
  493. OleDbCommandBuilder cmdbld1=new OleDbCommandBuilder(da1);*/
  494. OleDbCommand cmd=new OleDbCommand(StrSQL,conn);
  495. cmd.ExecuteNonQuery();
  496. //da1.Update(mytable1);
  497. MessageBox.Show("增加数据集记录操作成功!","信息提示",MessageBoxButtons.OK,MessageBoxIcon.Information);
  498. }
  499. catch(Exception Err)
  500. {
  501. MessageBox.Show("增加数据集记录操作失败:"+Err.Message,"信息提示",MessageBoxButtons.OK,MessageBoxIcon.Information);
  502. }
  503. }
  504. private void panel1_Paint(object sender, System.Windows.Forms.PaintEventArgs e)
  505. {
  506. }
  507. private void button1_Click(object sender, System.EventArgs e)
  508. {
  509. Application.Exit();
  510. }
  511. private void button11_Click(object sender, System.EventArgs e)
  512. {
  513. Application.Exit();
  514. }
  515. private void button12_Click(object sender, System.EventArgs e)
  516. {
  517. //修改记录
  518. try
  519. {
  520. OleDbConnection conn2=new OleDbConnection(@"provider=Microsoft.jet.oledb.4.0;data source="+Application.StartupPath+ "\xqwy.mdb");
  521. conn2.Open();
  522. string strsql="select * from user1 where name='"+this.textBox2.Text.Trim()+"' ";
  523. OleDbDataAdapter da=new OleDbDataAdapter(strsql,conn2);
  524. DataSet ds=new DataSet();
  525. da.Fill(ds);
  526. DataTable mytable=new DataTable();
  527. mytable=ds.Tables[0];
  528. DataRow row1;
  529. row1=mytable.Rows[0];
  530. row1[0]=this.textBox2.Text.Trim();
  531. row1[1]=this.textBox3.Text.Trim();
  532. OleDbCommandBuilder cmdbld=new OleDbCommandBuilder(da);
  533. da.Update(mytable);
  534. MessageBox.Show("密码修改成功!");
  535. conn2.Close();
  536. }
  537. catch(Exception err)
  538. {
  539. MessageBox.Show(err.Message);
  540. }
  541. }
  542. private void button3_Click(object sender, System.EventArgs e)
  543. {
  544. }
  545. private void button2_Click(object sender, System.EventArgs e)
  546. {
  547. }
  548. private void button19_Click(object sender, System.EventArgs e)
  549. {
  550. try
  551. {
  552. string connstr="Provider=Microsoft.jet.oledb.4.0;data source="+Application.StartupPath+"\xqwy.mdb";
  553. OleDbConnection conn=new OleDbConnection(connstr);
  554. conn.Open();
  555. string StrSQL="DELETE FROM  user1 WHERE ";
  556. StrSQL+=" Name='"+this.textBox2.Text+"'";
  557. //"delete from user1 where( "Name="'"+this.textBox2.Text.Trim()+"','"+this.textBox3.Text.Trim()+"')";
  558. //string StrSQL="DELETE FROM  user1 WHERE(Name='"+this.textBox2.Text.Trim()+"'and Passwd='"+this.textBox3.Text.Trim()+"')";
  559. //StrSQL+="Name='"+this.textBox2.Text.Trim()+"'";
  560. //StrSQL+="Passwd='"+this.textBox3.Text.Trim()+"'";
  561. OleDbCommand cmd=new OleDbCommand(StrSQL,conn);
  562. cmd.ExecuteNonQuery();
  563. MessageBox.Show("删除数据集记录操作成功!","信息提示",MessageBoxButtons.OK,MessageBoxIcon.Information);
  564. }
  565. catch(Exception Err)
  566. {
  567. MessageBox.Show("删除数据集记录操作失败:"+Err.Message,"信息提示",MessageBoxButtons.OK,MessageBoxIcon.Information);
  568. }
  569. }
  570. }
  571. }