📄 zjyg.cs
字号:
new System.Data.Common.DataColumnMapping("办公地址", "办公地址"),
new System.Data.Common.DataColumnMapping("电子邮箱", "电子邮箱"),
new System.Data.Common.DataColumnMapping("密码", "密码"),
new System.Data.Common.DataColumnMapping("手机", "手机"),
new System.Data.Common.DataColumnMapping("系统管理员", "系统管理员"),
new System.Data.Common.DataColumnMapping("姓名", "姓名"),
new System.Data.Common.DataColumnMapping("性别", "性别"),
new System.Data.Common.DataColumnMapping("用户名", "用户名")})});
this.oleDbDataAdapter1.UpdateCommand = this.oleDbUpdateCommand1;
//
// oleDbDeleteCommand1
//
this.oleDbDeleteCommand1.CommandText = @"DELETE FROM ygxxb WHERE (用户名 = ?) AND (ICQ = ? OR ? IS NULL AND ICQ IS NULL) AND (OICQ = ? OR ? IS NULL AND OICQ IS NULL) AND (办公地址 = ? OR ? IS NULL AND 办公地址 IS NULL) AND (姓名 = ?) AND (密码 = ?) AND (性别 = ?) AND (手机 = ? OR ? IS NULL AND 手机 IS NULL) AND (电子邮箱 = ? OR ? IS NULL AND 电子邮箱 IS NULL) AND (系统管理员 = ? OR ? IS NULL AND 系统管理员 IS NULL)";
this.oleDbDeleteCommand1.Connection = this.oleDbConnection1;
this.oleDbDeleteCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("Original_用户名", System.Data.OleDb.OleDbType.VarWChar, 20, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "用户名", System.Data.DataRowVersion.Original, null));
this.oleDbDeleteCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("Original_ICQ", System.Data.OleDb.OleDbType.VarWChar, 20, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "ICQ", System.Data.DataRowVersion.Original, null));
this.oleDbDeleteCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("Original_ICQ1", System.Data.OleDb.OleDbType.VarWChar, 20, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "ICQ", System.Data.DataRowVersion.Original, null));
this.oleDbDeleteCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("Original_OICQ", System.Data.OleDb.OleDbType.VarWChar, 20, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "OICQ", System.Data.DataRowVersion.Original, null));
this.oleDbDeleteCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("Original_OICQ1", System.Data.OleDb.OleDbType.VarWChar, 20, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "OICQ", System.Data.DataRowVersion.Original, null));
this.oleDbDeleteCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("Original_办公地址", System.Data.OleDb.OleDbType.VarWChar, 50, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "办公地址", System.Data.DataRowVersion.Original, null));
this.oleDbDeleteCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("Original_办公地址1", System.Data.OleDb.OleDbType.VarWChar, 50, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "办公地址", System.Data.DataRowVersion.Original, null));
this.oleDbDeleteCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("Original_姓名", System.Data.OleDb.OleDbType.VarWChar, 5, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "姓名", System.Data.DataRowVersion.Original, null));
this.oleDbDeleteCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("Original_密码", System.Data.OleDb.OleDbType.VarWChar, 20, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "密码", System.Data.DataRowVersion.Original, null));
this.oleDbDeleteCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("Original_性别", System.Data.OleDb.OleDbType.VarWChar, 1, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "性别", System.Data.DataRowVersion.Original, null));
this.oleDbDeleteCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("Original_手机", System.Data.OleDb.OleDbType.VarWChar, 20, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "手机", System.Data.DataRowVersion.Original, null));
this.oleDbDeleteCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("Original_手机1", System.Data.OleDb.OleDbType.VarWChar, 20, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "手机", System.Data.DataRowVersion.Original, null));
this.oleDbDeleteCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("Original_电子邮箱", System.Data.OleDb.OleDbType.VarWChar, 30, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "电子邮箱", System.Data.DataRowVersion.Original, null));
this.oleDbDeleteCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("Original_电子邮箱1", System.Data.OleDb.OleDbType.VarWChar, 30, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "电子邮箱", System.Data.DataRowVersion.Original, null));
this.oleDbDeleteCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("Original_系统管理员", System.Data.OleDb.OleDbType.VarWChar, 1, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "系统管理员", System.Data.DataRowVersion.Original, null));
this.oleDbDeleteCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("Original_系统管理员1", System.Data.OleDb.OleDbType.VarWChar, 1, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "系统管理员", System.Data.DataRowVersion.Original, null));
//
// oleDbConnection1
//
this.oleDbConnection1.ConnectionString = @"Jet OLEDB:Global Partial Bulk Ops=2;Jet OLEDB:Registry Path=;Jet OLEDB:Database Locking Mode=1;Data Source="".\tsglxt.mdb"";Jet OLEDB:Engine Type=5;Provider=""Microsoft.Jet.OLEDB.4.0"";Jet OLEDB:System database=;Jet OLEDB:SFP=False;persist security info=False;Extended Properties=;Mode=Share Deny None;Jet OLEDB:Encrypt Database=False;Jet OLEDB:Create System Database=False;Jet OLEDB:Don't Copy Locale on Compact=False;Jet OLEDB:Compact Without Replica Repair=False;User ID=Admin;Jet OLEDB:Global Bulk Transactions=1";
//
// oleDbInsertCommand1
//
this.oleDbInsertCommand1.CommandText = "INSERT INTO ygxxb(ICQ, OICQ, 办公地址, 电子邮箱, 密码, 手机, 系统管理员, 姓名, 性别, 用户名) VALUES (?, ?" +
", ?, ?, ?, ?, ?, ?, ?, ?)";
this.oleDbInsertCommand1.Connection = this.oleDbConnection1;
this.oleDbInsertCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("ICQ", System.Data.OleDb.OleDbType.VarWChar, 20, "ICQ"));
this.oleDbInsertCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("OICQ", System.Data.OleDb.OleDbType.VarWChar, 20, "OICQ"));
this.oleDbInsertCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("办公地址", System.Data.OleDb.OleDbType.VarWChar, 50, "办公地址"));
this.oleDbInsertCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("电子邮箱", System.Data.OleDb.OleDbType.VarWChar, 30, "电子邮箱"));
this.oleDbInsertCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("密码", System.Data.OleDb.OleDbType.VarWChar, 20, "密码"));
this.oleDbInsertCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("手机", System.Data.OleDb.OleDbType.VarWChar, 20, "手机"));
this.oleDbInsertCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("系统管理员", System.Data.OleDb.OleDbType.VarWChar, 1, "系统管理员"));
this.oleDbInsertCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("姓名", System.Data.OleDb.OleDbType.VarWChar, 5, "姓名"));
this.oleDbInsertCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("性别", System.Data.OleDb.OleDbType.VarWChar, 1, "性别"));
this.oleDbInsertCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("用户名", System.Data.OleDb.OleDbType.VarWChar, 20, "用户名"));
//
// oleDbSelectCommand1
//
this.oleDbSelectCommand1.CommandText = "SELECT ICQ, OICQ, 办公地址, 电子邮箱, 密码, 手机, 系统管理员, 姓名, 性别, 用户名 FROM ygxxb";
this.oleDbSelectCommand1.Connection = this.oleDbConnection1;
//
// oleDbUpdateCommand1
//
this.oleDbUpdateCommand1.CommandText = @"UPDATE ygxxb SET ICQ = ?, OICQ = ?, 办公地址 = ?, 电子邮箱 = ?, 密码 = ?, 手机 = ?, 系统管理员 = ?, 姓名 = ?, 性别 = ?, 用户名 = ? WHERE (用户名 = ?) AND (ICQ = ? OR ? IS NULL AND ICQ IS NULL) AND (OICQ = ? OR ? IS NULL AND OICQ IS NULL) AND (办公地址 = ? OR ? IS NULL AND 办公地址 IS NULL) AND (姓名 = ?) AND (密码 = ?) AND (性别 = ?) AND (手机 = ? OR ? IS NULL AND 手机 IS NULL) AND (电子邮箱 = ? OR ? IS NULL AND 电子邮箱 IS NULL) AND (系统管理员 = ? OR ? IS NULL AND 系统管理员 IS NULL)";
this.oleDbUpdateCommand1.Connection = this.oleDbConnection1;
this.oleDbUpdateCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("ICQ", System.Data.OleDb.OleDbType.VarWChar, 20, "ICQ"));
this.oleDbUpdateCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("OICQ", System.Data.OleDb.OleDbType.VarWChar, 20, "OICQ"));
this.oleDbUpdateCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("办公地址", System.Data.OleDb.OleDbType.VarWChar, 50, "办公地址"));
this.oleDbUpdateCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("电子邮箱", System.Data.OleDb.OleDbType.VarWChar, 30, "电子邮箱"));
this.oleDbUpdateCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("密码", System.Data.OleDb.OleDbType.VarWChar, 20, "密码"));
this.oleDbUpdateCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("手机", System.Data.OleDb.OleDbType.VarWChar, 20, "手机"));
this.oleDbUpdateCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("系统管理员", System.Data.OleDb.OleDbType.VarWChar, 1, "系统管理员"));
this.oleDbUpdateCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("姓名", System.Data.OleDb.OleDbType.VarWChar, 5, "姓名"));
this.oleDbUpdateCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("性别", System.Data.OleDb.OleDbType.VarWChar, 1, "性别"));
this.oleDbUpdateCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("用户名", System.Data.OleDb.OleDbType.VarWChar, 20, "用户名"));
this.oleDbUpdateCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("Original_用户名", System.Data.OleDb.OleDbType.VarWChar, 20, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "用户名", System.Data.DataRowVersion.Original, null));
this.oleDbUpdateCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("Original_ICQ", System.Data.OleDb.OleDbType.VarWChar, 20, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "ICQ", System.Data.DataRowVersion.Original, null));
this.oleDbUpdateCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("Original_ICQ1", System.Data.OleDb.OleDbType.VarWChar, 20, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "ICQ", System.Data.DataRowVersion.Original, null));
this.oleDbUpdateCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("Original_OICQ", System.Data.OleDb.OleDbType.VarWChar, 20, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "OICQ", System.Data.DataRowVersion.Original, null));
this.oleDbUpdateCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("Original_OICQ1", System.Data.OleDb.OleDbType.VarWChar, 20, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "OICQ", System.Data.DataRowVersion.Original, null));
this.oleDbUpdateCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("Original_办公地址", System.Data.OleDb.OleDbType.VarWChar, 50, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "办公地址", System.Data.DataRowVersion.Original, null));
this.oleDbUpdateCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("Original_办公地址1", System.Data.OleDb.OleDbType.VarWChar, 50, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "办公地址", System.Data.DataRowVersion.Original, null));
this.oleDbUpdateCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("Original_姓名", System.Data.OleDb.OleDbType.VarWChar, 5, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "姓名", System.Data.DataRowVersion.Original, null));
this.oleDbUpdateCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("Original_密码", System.Data.OleDb.OleDbType.VarWChar, 20, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "密码", System.Data.DataRowVersion.Original, null));
this.oleDbUpdateCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("Original_性别", System.Data.OleDb.OleDbType.VarWChar, 1, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "性别", System.Data.DataRowVersion.Original, null));
this.oleDbUpdateCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("Original_手机", System.Data.OleDb.OleDbType.VarWChar, 20, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "手机", System.Data.DataRowVersion.Original, null));
this.oleDbUpdateCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("Original_手机1", System.Data.OleDb.OleDbType.VarWChar, 20, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "手机", System.Data.DataRowVersion.Original, null));
this.oleDbUpdateCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("Original_电子邮箱", System.Data.OleDb.OleDbType.VarWChar, 30, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "电子邮箱", System.Data.DataRowVersion.Original, null));
this.oleDbUpdateCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("Original_电子邮箱1", System.Data.OleDb.OleDbType.VarWChar, 30, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "电子邮箱", System.Data.DataRowVersion.Original, null));
this.oleDbUpdateCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("Original_系统管理员", System.Data.OleDb.OleDbType.VarWChar, 1, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "系统管理员", System.Data.DataRowVersion.Original, null));
this.oleDbUpdateCommand1.Parameters.Add(new System.Data.OleDb.OleDbParameter("Original_系统管理员1", System.Data.OleDb.OleDbType.VarWChar, 1, System.Data.ParameterDirection.Input, false, ((System.Byte)(0)), ((System.Byte)(0)), "系统管理员", System.Data.DataRowVersion.Original, null));
//
// dataSet21
//
this.dataSet21.DataSetName = "DataSet2";
this.dataSet21.Locale = new System.Globalization.CultureInfo("zh-CN");
//
// zjyg
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(928, 422);
this.Controls.Add(this.groupBox2);
this.Controls.Add(this.groupBox1);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Name = "zjyg";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "添加员工";
this.Load += new System.EventHandler(this.zjyg_Load);
this.groupBox1.ResumeLayout(false);
this.groupBox2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.dataSet21)).EndInit();
this.ResumeLayout(false);
}
#endregion
private void button3_Click(object sender, System.EventArgs e)
{
this.Close();
}
private void button2_Click(object sender, System.EventArgs e)
{
this.textBox1.Text="";
this.textBox2.Text="";
this.textBox3.Text="否";
this.textBox4.Text="";
this.textBox5.Text="男";
this.textBox6.Text="";
this.textBox7.Text="";
this.textBox8.Text="";
this.textBox9.Text="";
this.textBox10.Text="";
this.textBox11.Text="";
this.textBox1.Focus();
}
private void button1_Click(object sender, System.EventArgs e)
{
try
{
if( this.textBox1.Text=="" )
{
MessageBox.Show("用名不能为空,请输入用户名.","数据输入提示:",MessageBoxButtons.OK,MessageBoxIcon.Exclamation);
this.textBox1.Focus();
}
else
{
System.Data.OleDb.OleDbCommand MySelect=this.oleDbConnection1.CreateCommand();
MySelect.CommandText="SELECT 用户名 FROM ygxxb WHERE 用户名='"+this.textBox1.Text+"'";
this.oleDbDataAdapter1.SelectCommand=MySelect;
this.oleDbConnection1.Open();
int IFUSER=this.oleDbDataAdapter1.Fill(this.dataSet21,"ygxxb");;
this.oleDbConnection1.Close();
if(IFUSER ==0)
{
if(this.textBox2.Text=="" || this.textBox11.Text=="")
{
MessageBox.Show("用户密码不能为空,请输入.","数据输入提示:",MessageBoxButtons.OK,MessageBoxIcon.Exclamation);
this.textBox2.Focus();
}
else
{
if(this.textBox2.Text != this.textBox11.Text)
{
MessageBox.Show("两次密码不一样,请重新输入.","数据输入提示:",MessageBoxButtons.OK,MessageBoxIcon.Exclamation);
this.textBox11.Focus();
}
else
{
if(this.textBox4.Text=="")
{
MessageBox.Show("用户姓名不能为空,请输入.","数据输入提示:",MessageBoxButtons.OK,MessageBoxIcon.Exclamation);
this.textBox4.Focus();
}
else
{
if(this.textBox3.Text=="")
{
MessageBox.Show("是否为管理员不能为空!!!","数据输入提示:",MessageBoxButtons.OK,MessageBoxIcon.Exclamation);
this.textBox3.Focus();
}
else
{
if(this.textBox3.Text !="是" & this.textBox3.Text != "否")
{
MessageBox.Show("管理员只有是与不是,请输入"是"或"否"","数据输入提示:",MessageBoxButtons.OK,MessageBoxIcon.Exclamation);
this.textBox3.Focus();
}
else
{
if(this.textBox5.Text=="")
{
MessageBox.Show("用户性别不能为空,请输入.","数据输入提示:",MessageBoxButtons.OK,MessageBoxIcon.Exclamation);
this.textBox5.Focus();
}
else
{
if(this.textBox5.Text != "男" & this.textBox5.Text != "女")
{
MessageBox.Show("用户性别只能为男或女,请重新输入.","数据输入提示:",MessageBoxButtons.OK,MessageBoxIcon.Exclamation);
this.textBox5.Focus();
}
else
{
System.Data.OleDb.OleDbCommand MyInsert = this.oleDbConnection1.CreateCommand();
MyInsert.CommandText="INSERT INTO ygxxb(用户名,密码,系统管理员,姓名,性别,手机,办公地址,ICQ,OICQ,电子邮箱) VALUES ('"+this.textBox1.Text+"','"+this.textBox2.Text+"','"+this.textBox3.Text+"','"+this.textBox4.Text+"','"+this.textBox5.Text+"','"+this.textBox6.Text+"','"+this.textBox7.Text+"','"+this.textBox8.Text+"','"+this.textBox9.Text+"','"+this.textBox10.Text+"')";
this.oleDbDataAdapter1.InsertCommand=MyInsert;
this.oleDbConnection1.Open();
MyInsert.ExecuteNonQuery();
this.oleDbConnection1.Close();
MessageBox.Show("员工添加成功!!!","员工添加提示:",MessageBoxButtons.OK,MessageBoxIcon.Asterisk);
this.textBox1.Text="";
this.textBox2.Text="";
this.textBox3.Text="否";
this.textBox4.Text="";
this.textBox5.Text="男";
this.textBox6.Text="";
this.textBox7.Text="";
this.textBox8.Text="";
this.textBox9.Text="";
this.textBox10.Text="";
this.textBox11.Text="";
this.textBox1.Focus();
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -