opermana.cs
上传用户:toshiba_01
上传日期:2007-06-08
资源大小:306k
文件大小:22k
- using System;
- using System.Drawing;
- using System.Collections;
- using System.ComponentModel;
- using System.Windows.Forms;
- using System.Data ;
- using System.Data .SqlClient ;
- namespace RoomManage
- {
- /// <summary>
- /// opermana 的摘要说明。
- /// </summary>
- public class opermana : System.Windows.Forms.Form
- {
- private System.Windows.Forms.Button button1;
- /// <summary>
- /// 必需的设计器变量。
- /// </summary>
- private System.ComponentModel.Container components = null;
- private System.Windows.Forms.Label label1;
- private System.Windows.Forms.Label label2;
- private System.Windows.Forms.TextBox textBox1;
- private System.Windows.Forms.TextBox textBox2;
- char pur='0';
- private System.Windows.Forms.Label label3;
- private System.Windows.Forms.TabControl tabControl1;
- private System.Windows.Forms.TabPage tabPage1;
- private System.Windows.Forms.TabPage tabPage2;
- private System.Windows.Forms.Label label4;
- private System.Windows.Forms.GroupBox groupBox1;
- private System.Windows.Forms.Button button2;
- private System.Windows.Forms.Button button3;
- private System.Windows.Forms.Label label5;
- private System.Windows.Forms.Label label6;
- private System.Windows.Forms.Label label7;
- private System.Windows.Forms.Label label8;
- private System.Windows.Forms.TextBox tbbh;
- private System.Windows.Forms.TextBox tbxm;
- private System.Windows.Forms.TextBox tbmm;
- private System.Windows.Forms.ComboBox cbjb;
- private System.Windows.Forms.TextBox tbbz;
- private System.Windows.Forms.GroupBox groupBox2;
- private System.Windows.Forms.Button buttappend;
- private System.Windows.Forms.Button buttdelete;
- private System.Windows.Forms.Button buttedit;
- private System.Windows.Forms.Button buttsave;
- private System.Windows.Forms.Button buttcancer;
- private System.Windows.Forms.ComboBox cbbh;
-
- string nam="";
- DataConn dc=new DataConn ();
- int opernum=0;//标志执行哪种操作
- public opermana(char cc,string ss)
- {
- //
- // Windows 窗体设计器支持所必需的
- //
- InitializeComponent();
- pur=cc;
- nam=ss;
- //
- // 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()
- {
- this.button1 = new System.Windows.Forms.Button();
- this.label1 = new System.Windows.Forms.Label();
- this.label2 = new System.Windows.Forms.Label();
- this.textBox1 = new System.Windows.Forms.TextBox();
- this.textBox2 = new System.Windows.Forms.TextBox();
- this.label3 = new System.Windows.Forms.Label();
- this.tabControl1 = new System.Windows.Forms.TabControl();
- this.tabPage1 = new System.Windows.Forms.TabPage();
- this.button2 = new System.Windows.Forms.Button();
- this.button3 = new System.Windows.Forms.Button();
- this.tabPage2 = new System.Windows.Forms.TabPage();
- this.buttappend = new System.Windows.Forms.Button();
- this.groupBox2 = new System.Windows.Forms.GroupBox();
- this.cbbh = new System.Windows.Forms.ComboBox();
- this.tbbh = new System.Windows.Forms.TextBox();
- this.label4 = new System.Windows.Forms.Label();
- this.label5 = new System.Windows.Forms.Label();
- this.label6 = new System.Windows.Forms.Label();
- this.label7 = new System.Windows.Forms.Label();
- this.label8 = new System.Windows.Forms.Label();
- this.tbxm = new System.Windows.Forms.TextBox();
- this.tbmm = new System.Windows.Forms.TextBox();
- this.cbjb = new System.Windows.Forms.ComboBox();
- this.tbbz = new System.Windows.Forms.TextBox();
- this.buttdelete = new System.Windows.Forms.Button();
- this.buttedit = new System.Windows.Forms.Button();
- this.buttsave = new System.Windows.Forms.Button();
- this.buttcancer = new System.Windows.Forms.Button();
- this.groupBox1 = new System.Windows.Forms.GroupBox();
- this.tabControl1.SuspendLayout();
- this.tabPage1.SuspendLayout();
- this.tabPage2.SuspendLayout();
- this.groupBox1.SuspendLayout();
- this.SuspendLayout();
- //
- // button1
- //
- this.button1.Location = new System.Drawing.Point(232, 288);
- this.button1.Name = "button1";
- this.button1.Size = new System.Drawing.Size(64, 23);
- this.button1.TabIndex = 0;
- this.button1.Text = "退出";
- this.button1.Click += new System.EventHandler(this.button1_Click);
- //
- // label1
- //
- this.label1.Location = new System.Drawing.Point(48, 48);
- this.label1.Name = "label1";
- this.label1.Size = new System.Drawing.Size(72, 23);
- this.label1.TabIndex = 1;
- this.label1.Text = "新 密 码:";
- this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
- //
- // label2
- //
- this.label2.Location = new System.Drawing.Point(48, 88);
- this.label2.Name = "label2";
- this.label2.Size = new System.Drawing.Size(72, 23);
- this.label2.TabIndex = 1;
- this.label2.Text = "确认密码:";
- this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
- //
- // textBox1
- //
- this.textBox1.Location = new System.Drawing.Point(128, 48);
- this.textBox1.Name = "textBox1";
- this.textBox1.PasswordChar = '*';
- this.textBox1.TabIndex = 2;
- this.textBox1.Text = "";
- //
- // textBox2
- //
- this.textBox2.Location = new System.Drawing.Point(128, 88);
- this.textBox2.Name = "textBox2";
- this.textBox2.PasswordChar = '*';
- this.textBox2.TabIndex = 2;
- this.textBox2.Text = "";
- //
- // label3
- //
- this.label3.Location = new System.Drawing.Point(16, 8);
- this.label3.Name = "label3";
- this.label3.TabIndex = 3;
- this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
- //
- // tabControl1
- //
- this.tabControl1.Controls.Add(this.tabPage1);
- this.tabControl1.Controls.Add(this.tabPage2);
- this.tabControl1.Dock = System.Windows.Forms.DockStyle.Fill;
- this.tabControl1.Location = new System.Drawing.Point(3, 17);
- this.tabControl1.Name = "tabControl1";
- this.tabControl1.SelectedIndex = 0;
- this.tabControl1.Size = new System.Drawing.Size(290, 228);
- this.tabControl1.TabIndex = 4;
- //
- // tabPage1
- //
- this.tabPage1.Controls.Add(this.button2);
- this.tabPage1.Controls.Add(this.label1);
- this.tabPage1.Controls.Add(this.textBox1);
- this.tabPage1.Controls.Add(this.label2);
- this.tabPage1.Controls.Add(this.textBox2);
- this.tabPage1.Controls.Add(this.button3);
- this.tabPage1.Location = new System.Drawing.Point(4, 21);
- this.tabPage1.Name = "tabPage1";
- this.tabPage1.Size = new System.Drawing.Size(282, 203);
- this.tabPage1.TabIndex = 0;
- this.tabPage1.Text = "密码修改";
- //
- // button2
- //
- this.button2.Location = new System.Drawing.Point(48, 136);
- this.button2.Name = "button2";
- this.button2.TabIndex = 3;
- this.button2.Text = "确定";
- this.button2.Click += new System.EventHandler(this.button2_Click);
- //
- // button3
- //
- this.button3.Location = new System.Drawing.Point(153, 136);
- this.button3.Name = "button3";
- this.button3.TabIndex = 3;
- this.button3.Text = "取消";
- this.button3.Click += new System.EventHandler(this.button3_Click);
- //
- // tabPage2
- //
- this.tabPage2.Controls.Add(this.buttappend);
- this.tabPage2.Controls.Add(this.groupBox2);
- this.tabPage2.Controls.Add(this.cbbh);
- this.tabPage2.Controls.Add(this.tbbh);
- this.tabPage2.Controls.Add(this.label4);
- this.tabPage2.Controls.Add(this.label5);
- this.tabPage2.Controls.Add(this.label6);
- this.tabPage2.Controls.Add(this.label7);
- this.tabPage2.Controls.Add(this.label8);
- this.tabPage2.Controls.Add(this.tbxm);
- this.tabPage2.Controls.Add(this.tbmm);
- this.tabPage2.Controls.Add(this.cbjb);
- this.tabPage2.Controls.Add(this.tbbz);
- this.tabPage2.Controls.Add(this.buttdelete);
- this.tabPage2.Controls.Add(this.buttedit);
- this.tabPage2.Controls.Add(this.buttsave);
- this.tabPage2.Controls.Add(this.buttcancer);
- this.tabPage2.Location = new System.Drawing.Point(4, 21);
- this.tabPage2.Name = "tabPage2";
- this.tabPage2.Size = new System.Drawing.Size(282, 203);
- this.tabPage2.TabIndex = 1;
- this.tabPage2.Text = "账号管理";
- //
- // buttappend
- //
- this.buttappend.Location = new System.Drawing.Point(8, 170);
- this.buttappend.Name = "buttappend";
- this.buttappend.Size = new System.Drawing.Size(48, 23);
- this.buttappend.TabIndex = 4;
- this.buttappend.Text = "添加";
- this.buttappend.Click += new System.EventHandler(this.buttappend_Click);
- //
- // groupBox2
- //
- this.groupBox2.Location = new System.Drawing.Point(0, 160);
- this.groupBox2.Name = "groupBox2";
- this.groupBox2.Size = new System.Drawing.Size(280, 3);
- this.groupBox2.TabIndex = 3;
- this.groupBox2.TabStop = false;
- //
- // cbbh
- //
- this.cbbh.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
- this.cbbh.Location = new System.Drawing.Point(112, 8);
- this.cbbh.Name = "cbbh";
- this.cbbh.Size = new System.Drawing.Size(100, 20);
- this.cbbh.TabIndex = 2;
- this.cbbh.SelectedIndexChanged += new System.EventHandler(this.cbbh_SelectedIndexChanged);
- //
- // tbbh
- //
- this.tbbh.Location = new System.Drawing.Point(112, 8);
- this.tbbh.Name = "tbbh";
- this.tbbh.ReadOnly = true;
- this.tbbh.TabIndex = 1;
- this.tbbh.Text = "";
- //
- // label4
- //
- this.label4.Location = new System.Drawing.Point(64, 8);
- this.label4.Name = "label4";
- this.label4.Size = new System.Drawing.Size(48, 23);
- this.label4.TabIndex = 0;
- this.label4.Text = "编号:";
- this.label4.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
- //
- // label5
- //
- this.label5.Location = new System.Drawing.Point(64, 38);
- this.label5.Name = "label5";
- this.label5.Size = new System.Drawing.Size(48, 23);
- this.label5.TabIndex = 0;
- this.label5.Text = "姓名:";
- this.label5.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
- //
- // label6
- //
- this.label6.Location = new System.Drawing.Point(64, 68);
- this.label6.Name = "label6";
- this.label6.Size = new System.Drawing.Size(48, 23);
- this.label6.TabIndex = 0;
- this.label6.Text = "密码:";
- this.label6.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
- //
- // label7
- //
- this.label7.Location = new System.Drawing.Point(64, 98);
- this.label7.Name = "label7";
- this.label7.Size = new System.Drawing.Size(48, 23);
- this.label7.TabIndex = 0;
- this.label7.Text = "级别:";
- this.label7.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
- //
- // label8
- //
- this.label8.Location = new System.Drawing.Point(64, 128);
- this.label8.Name = "label8";
- this.label8.Size = new System.Drawing.Size(48, 23);
- this.label8.TabIndex = 0;
- this.label8.Text = "备注:";
- this.label8.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
- //
- // tbxm
- //
- this.tbxm.Location = new System.Drawing.Point(112, 38);
- this.tbxm.Name = "tbxm";
- this.tbxm.TabIndex = 1;
- this.tbxm.Text = "";
- //
- // tbmm
- //
- this.tbmm.Location = new System.Drawing.Point(112, 68);
- this.tbmm.Name = "tbmm";
- this.tbmm.PasswordChar = '*';
- this.tbmm.TabIndex = 1;
- this.tbmm.Text = "";
- //
- // cbjb
- //
- this.cbjb.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
- this.cbjb.Items.AddRange(new object[] {
- "1",
- "2",
- "3"});
- this.cbjb.Location = new System.Drawing.Point(112, 98);
- this.cbjb.Name = "cbjb";
- this.cbjb.Size = new System.Drawing.Size(100, 20);
- this.cbjb.TabIndex = 2;
- //
- // tbbz
- //
- this.tbbz.Location = new System.Drawing.Point(112, 128);
- this.tbbz.Name = "tbbz";
- this.tbbz.TabIndex = 1;
- this.tbbz.Text = "";
- //
- // buttdelete
- //
- this.buttdelete.Location = new System.Drawing.Point(56, 170);
- this.buttdelete.Name = "buttdelete";
- this.buttdelete.Size = new System.Drawing.Size(48, 23);
- this.buttdelete.TabIndex = 4;
- this.buttdelete.Text = "删除";
- this.buttdelete.Click += new System.EventHandler(this.buttdelete_Click);
- //
- // buttedit
- //
- this.buttedit.Location = new System.Drawing.Point(104, 170);
- this.buttedit.Name = "buttedit";
- this.buttedit.Size = new System.Drawing.Size(48, 23);
- this.buttedit.TabIndex = 4;
- this.buttedit.Text = "修改";
- this.buttedit.Click += new System.EventHandler(this.buttedit_Click);
- //
- // buttsave
- //
- this.buttsave.Location = new System.Drawing.Point(176, 170);
- this.buttsave.Name = "buttsave";
- this.buttsave.Size = new System.Drawing.Size(48, 23);
- this.buttsave.TabIndex = 4;
- this.buttsave.Text = "保存";
- this.buttsave.Click += new System.EventHandler(this.buttsave_Click);
- //
- // buttcancer
- //
- this.buttcancer.Location = new System.Drawing.Point(224, 170);
- this.buttcancer.Name = "buttcancer";
- this.buttcancer.Size = new System.Drawing.Size(48, 23);
- this.buttcancer.TabIndex = 4;
- this.buttcancer.Text = "返回";
- this.buttcancer.Click += new System.EventHandler(this.buttcancer_Click);
- //
- // groupBox1
- //
- this.groupBox1.Controls.Add(this.tabControl1);
- this.groupBox1.Location = new System.Drawing.Point(8, 32);
- this.groupBox1.Name = "groupBox1";
- this.groupBox1.Size = new System.Drawing.Size(296, 248);
- this.groupBox1.TabIndex = 5;
- this.groupBox1.TabStop = false;
- //
- // opermana
- //
- this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
- this.ClientSize = new System.Drawing.Size(312, 336);
- this.ControlBox = false;
- this.Controls.Add(this.groupBox1);
- this.Controls.Add(this.label3);
- this.Controls.Add(this.button1);
- this.MaximizeBox = false;
- this.MaximumSize = new System.Drawing.Size(320, 344);
- this.MinimizeBox = false;
- this.MinimumSize = new System.Drawing.Size(320, 344);
- this.Name = "opermana";
- this.ShowInTaskbar = false;
- this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
- this.Text = "操作员管理";
- this.TopMost = true;
- this.Load += new System.EventHandler(this.opermana_Load);
- this.tabControl1.ResumeLayout(false);
- this.tabPage1.ResumeLayout(false);
- this.tabPage2.ResumeLayout(false);
- this.groupBox1.ResumeLayout(false);
- this.ResumeLayout(false);
- }
- #endregion
- private void button1_Click(object sender, System.EventArgs e)
- {
- if(MessageBox.Show("真的要退出吗?","注意",MessageBoxButtons.OKCancel,MessageBoxIcon.Question)==DialogResult.OK)
- this.Close ();
- }
- private void opermana_Load(object sender, System.EventArgs e)
- {
- label3.Text ="操 作 员:"+nam;
- cbbh.Visible =true;
- tbbh.Visible =false;
- tbxm.ReadOnly =true;
- tbmm.ReadOnly =true;
- tbbz.ReadOnly =true;
-
-
- if(pur!='1')
- {
- buttappend.Enabled =false;
- buttdelete.Enabled =false;
- buttedit.Enabled =false;
- buttsave.Enabled =false;
- buttcancer.Enabled =false;
- cbbh.Enabled =false;
- cbjb.Enabled=false;
- }
- else
- {
- buttappend.Enabled =true;
- buttdelete.Enabled =true;
- buttedit.Enabled =true;
- buttsave.Enabled =true;
- buttcancer.Enabled =true;
-
-
- string str=dc.connstr ;
- SqlConnection conn=new SqlConnection (str);
- string sql="select 操作员编号 from tabpurview";
- SqlDataAdapter adapter=new SqlDataAdapter (sql,conn);
- DataSet dataset=new DataSet ();
- adapter.Fill (dataset,"tab");
-
- cbbh.DisplayMember ="操作员编号";
- cbbh.DataSource =dataset.Tables ["tab"];
- conn.Dispose ();
- dataset.Dispose ();
- adapter.Dispose ();
- }
-
- }
- private void button3_Click(object sender, System.EventArgs e)
- {
- textBox1 .Text ="";
- textBox2.Text ="";
- }
- private void button2_Click(object sender, System.EventArgs e)
- {
- if(textBox1.Text ==textBox2.Text )
- {
- string str=dc.connstr ;
- SqlConnection conn=new SqlConnection (str);
- string sql="update tabpurview set 密码='"+textBox1.Text +"' where 操作员姓名='"+nam+"'";
- SqlCommand cmd=new SqlCommand (sql,conn);
- conn.Open ();
- cmd.ExecuteNonQuery ();
- MessageBox.Show ("操作成功!");
- conn.Close ();
- cmd.Dispose ();
- }
- else
- {
- MessageBox.Show ("您两次输入的密码不一致,请重新输入!");
- }
- }
- private void buttappend_Click(object sender, System.EventArgs e)
- {
- opernum=1;
- buttdelete.Enabled =false;
- buttedit.Enabled =false;
- cbbh.Visible =false;
- tbbh.Visible =true;
- tbxm.ReadOnly =false;
- tbmm.ReadOnly =false;
- tbbz.ReadOnly =false;
- string str=dc.connstr ;
- SqlConnection conn=new SqlConnection (str);
- string sql="select 操作员编号 from tabpurview";
- SqlDataAdapter adapter=new SqlDataAdapter (sql,conn);
- DataSet dataset=new DataSet ();
- adapter.Fill (dataset,"tab");
-
- cbbh.DisplayMember ="操作员编号";
- cbbh.DataSource =dataset.Tables ["tab"];
- conn.Dispose ();
- dataset.Dispose ();
- adapter.Dispose ();
- int cou=dataset.Tables ["tab"].Rows .Count ;
- cou++;
- tbbh.Text ="CZY"+cou.ToString ("d5");
- //防止编号重复
- for(int i=0;i<cou-1;i++)
- {
- cbbh.SelectedIndex=i;
- if(cbbh.Text ==tbbh.Text)
- {
- int a=cou+1;
- tbbh.Text ="CZY"+a.ToString ("d5");
- }
- }
- tbbz.Text ="";
- tbxm.Text ="";
- tbmm.Text ="";
- cbjb.SelectedIndex =-1;//为空
- }
- private void buttcancer_Click(object sender, System.EventArgs e)
- {
- cbbh.Visible =true;
- tbbh.Visible =false;
- cbbh.SelectedIndex =-1;
- tbxm.Text ="";
- tbmm.Text ="";
- cbjb.SelectedIndex =-1;
- tbbz.Text ="";
- tbxm.ReadOnly =true;
- tbmm.ReadOnly =true;
- tbbz.ReadOnly =true;
- buttappend.Enabled =true;
- buttdelete.Enabled =true;
- buttedit.Enabled =true;
- //刷新
- string str=dc.connstr ;
- SqlConnection conn=new SqlConnection (str);
- string sql="select 操作员编号 from tabpurview";
- SqlDataAdapter adapter=new SqlDataAdapter (sql,conn);
- DataSet dataset=new DataSet ();
- adapter.Fill (dataset,"tab");
-
- cbbh.DisplayMember ="操作员编号";
- cbbh.DataSource =dataset.Tables ["tab"];
- conn.Dispose ();
- dataset.Dispose ();
- adapter.Dispose ();
- }
- private void buttdelete_Click(object sender, System.EventArgs e)
- {
- opernum=2;
- buttappend.Enabled =false;
- buttedit.Enabled =false;
- }
- private void buttedit_Click(object sender, System.EventArgs e)
- {
- opernum=3;
- buttappend.Enabled =false;
- buttdelete.Enabled =false;
- tbxm.ReadOnly =false;
- tbmm.ReadOnly =false;
- tbbz.ReadOnly =false;
- }
- private void buttsave_Click(object sender, System.EventArgs e)
- {
- string str=dc.connstr ;
- SqlConnection conn=new SqlConnection (str);
- //添加
- if(opernum==1)
- {
-
- string sql="insert into tabpurview values(";
- sql=sql+"'"+tbbh.Text +"',";
- sql=sql+"'"+tbxm.Text +"',";
- sql=sql+"'"+tbmm.Text +"',";
- sql=sql+"'"+cbjb.Text +"',";
- sql=sql+"'"+tbbz.Text +"')";
- SqlCommand cmd=new SqlCommand (sql,conn);
- if(tbxm.Text .Length >0&tbmm.Text .Length >0&cbjb.Text .Length >0)
- {
- conn.Open ();
- cmd.ExecuteNonQuery ();
- MessageBox.Show ("操作成功!","恭喜",MessageBoxButtons.OK ,MessageBoxIcon.Information);
- }
- else
- {
- MessageBox.Show ("您的输入有误,请仔细检查,重新输入!","注意",MessageBoxButtons.OK ,MessageBoxIcon.Error );
- }
-
- cmd.Dispose ();
- conn.Close ();
- }
- //删除
- if(opernum==2)
- {
- string sql="delete tabpurview where 操作员编号='"+cbbh.Text +"'";
- SqlCommand cmd=new SqlCommand (sql,conn);
- if(MessageBox.Show("真的要删除吗?","注意",MessageBoxButtons.OKCancel,MessageBoxIcon.Question)==DialogResult.OK)
- {
- conn.Open ();
- cmd.ExecuteNonQuery ();
- MessageBox.Show ("操作成功!","恭喜",MessageBoxButtons.OK ,MessageBoxIcon.Information);
-
- string sql1="select 操作员编号 from tabpurview";
- SqlDataAdapter adapter=new SqlDataAdapter (sql1,conn);
- DataSet dataset=new DataSet ();
- adapter.Fill (dataset,"tab");
- cbbh.DisplayMember ="房间号";
- cbbh.DataSource =dataset.Tables ["tab"];
- dataset.Dispose ();
- adapter.Dispose ();
- }
- cmd.Dispose ();
- conn.Close ();
- }
- //修改
- if(opernum==3)
- {
- string sql="update tabpurview set 操作员姓名='"+tbxm.Text +"',密码='"+tbmm.Text +"',权限级别='"+cbjb.Text +"',备注='"+tbbz.Text +"' where 操作员编号='"+cbbh.Text +"'";
- SqlCommand cmd=new SqlCommand (sql,conn);
- if(MessageBox.Show("真的所做的修改吗?","注意",MessageBoxButtons.OKCancel,MessageBoxIcon.Question)==DialogResult.OK)
- {
- conn.Open ();
- cmd.ExecuteNonQuery ();
- MessageBox.Show ("操作成功!","恭喜",MessageBoxButtons.OK ,MessageBoxIcon.Information);
- }
- cmd.Dispose ();
- conn.Close ();
- }
- }
- private void cbbh_SelectedIndexChanged(object sender, System.EventArgs e)
- {
- string str=dc.connstr ;
- SqlConnection conn=new SqlConnection (str);
- string sql="select * from tabpurview where 操作员编号='"+this.cbbh .Text +"'";
- SqlDataAdapter adapter=new SqlDataAdapter (sql,conn);
- DataSet dataset=new DataSet ();
- adapter.Fill (dataset,"tab");
- tbxm .DataBindings.Add (new Binding ("Text",dataset,"tab.操作员姓名"));
- tbmm .DataBindings.Add (new Binding ("Text",dataset,"tab.密码"));
- cbjb .DataBindings.Add (new Binding ("Text",dataset,"tab.权限级别"));
- tbbz .DataBindings.Add (new Binding ("Text",dataset,"tab.备注"));
- tbxm.DataBindings .Clear ();
- tbmm.DataBindings .Clear ();
- cbjb.DataBindings .Clear ();
- tbbz.DataBindings .Clear ();
- conn.Dispose ();
- dataset.Dispose ();
- adapter.Dispose ();
- }
- }
- }