?? fmdanwei.cs
字號(hào):
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Data.SqlClient;
namespace 招聘考試成績(jī)管理系統(tǒng)
{
/// <summary>
/// FMdanwei 的摘要說明。
/// </summary>
public class FMdanwei : System.Windows.Forms.Form
{
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.TextBox textBox2;
private System.Windows.Forms.TextBox textBox3;
private System.Windows.Forms.TextBox textBox4;
private System.Windows.Forms.TextBox textBox5;
private System.Windows.Forms.GroupBox groupBox2;
private System.Windows.Forms.TextBox textBox6;
private BindingManagerBase index;
private System.Data.DataSet ds;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.Button button3;
private System.Windows.Forms.Button button4;
private System.Windows.Forms.Button button5;
private System.Windows.Forms.Button button6;
private System.Windows.Forms.Button button7;
private System.Windows.Forms.Label lbDno;
/// <summary>
/// 必需的設(shè)計(jì)器變量。
/// </summary>
private System.ComponentModel.Container components = null;
public FMdanwei()
{
//
// Windows 窗體設(shè)計(jì)器支持所必需的
//
InitializeComponent();
//
// TODO: 在 InitializeComponent 調(diào)用后添加任何構(gòu)造函數(shù)代碼
//
}
/// <summary>
/// 清理所有正在使用的資源。
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows 窗體設(shè)計(jì)器生成的代碼
/// <summary>
/// 設(shè)計(jì)器支持所需的方法 - 不要使用代碼編輯器修改
/// 此方法的內(nèi)容。
/// </summary>
private void InitializeComponent()
{
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.textBox5 = new System.Windows.Forms.TextBox();
this.textBox4 = new System.Windows.Forms.TextBox();
this.textBox3 = new System.Windows.Forms.TextBox();
this.textBox2 = new System.Windows.Forms.TextBox();
this.textBox1 = new System.Windows.Forms.TextBox();
this.label6 = new System.Windows.Forms.Label();
this.label5 = new System.Windows.Forms.Label();
this.groupBox2 = new System.Windows.Forms.GroupBox();
this.textBox6 = new System.Windows.Forms.TextBox();
this.button1 = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
this.button3 = new System.Windows.Forms.Button();
this.button4 = new System.Windows.Forms.Button();
this.button5 = new System.Windows.Forms.Button();
this.button6 = new System.Windows.Forms.Button();
this.button7 = new System.Windows.Forms.Button();
this.lbDno = new System.Windows.Forms.Label();
this.groupBox1.SuspendLayout();
this.groupBox2.SuspendLayout();
this.SuspendLayout();
//
// label1
//
this.label1.Font = new System.Drawing.Font("宋體", 14.25F, System.Drawing.FontStyle.Bold);
this.label1.Location = new System.Drawing.Point(184, 16);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(144, 23);
this.label1.TabIndex = 0;
this.label1.Text = "錄用單位信息";
this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// label2
//
this.label2.Location = new System.Drawing.Point(16, 32);
this.label2.Name = "label2";
this.label2.TabIndex = 1;
this.label2.Text = "單位名稱:";
this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// label3
//
this.label3.Location = new System.Drawing.Point(16, 72);
this.label3.Name = "label3";
this.label3.TabIndex = 2;
this.label3.Text = "錄取分?jǐn)?shù)要求:";
this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// label4
//
this.label4.Location = new System.Drawing.Point(16, 112);
this.label4.Name = "label4";
this.label4.TabIndex = 3;
this.label4.Text = "郵箱:";
this.label4.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// groupBox1
//
this.groupBox1.Controls.Add(this.textBox5);
this.groupBox1.Controls.Add(this.textBox4);
this.groupBox1.Controls.Add(this.textBox3);
this.groupBox1.Controls.Add(this.textBox2);
this.groupBox1.Controls.Add(this.textBox1);
this.groupBox1.Controls.Add(this.label6);
this.groupBox1.Controls.Add(this.label5);
this.groupBox1.Controls.Add(this.label4);
this.groupBox1.Controls.Add(this.label3);
this.groupBox1.Controls.Add(this.label2);
this.groupBox1.Controls.Add(this.groupBox2);
this.groupBox1.Controls.Add(this.lbDno);
this.groupBox1.Location = new System.Drawing.Point(16, 56);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(520, 240);
this.groupBox1.TabIndex = 4;
this.groupBox1.TabStop = false;
//
// textBox5
//
this.textBox5.Location = new System.Drawing.Point(128, 192);
this.textBox5.Name = "textBox5";
this.textBox5.Size = new System.Drawing.Size(144, 21);
this.textBox5.TabIndex = 10;
this.textBox5.Text = "";
//
// textBox4
//
this.textBox4.Location = new System.Drawing.Point(128, 152);
this.textBox4.Name = "textBox4";
this.textBox4.Size = new System.Drawing.Size(144, 21);
this.textBox4.TabIndex = 9;
this.textBox4.Text = "";
//
// textBox3
//
this.textBox3.Location = new System.Drawing.Point(128, 112);
this.textBox3.Name = "textBox3";
this.textBox3.Size = new System.Drawing.Size(144, 21);
this.textBox3.TabIndex = 8;
this.textBox3.Text = "";
//
// textBox2
//
this.textBox2.Location = new System.Drawing.Point(128, 72);
this.textBox2.Name = "textBox2";
this.textBox2.Size = new System.Drawing.Size(144, 21);
this.textBox2.TabIndex = 7;
this.textBox2.Text = "";
//
// textBox1
//
this.textBox1.Location = new System.Drawing.Point(128, 32);
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(144, 21);
this.textBox1.TabIndex = 6;
this.textBox1.Text = "";
//
// label6
//
this.label6.Location = new System.Drawing.Point(16, 192);
this.label6.Name = "label6";
this.label6.TabIndex = 5;
this.label6.Text = "電話:";
this.label6.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// label5
//
this.label5.Location = new System.Drawing.Point(16, 152);
this.label5.Name = "label5";
this.label5.TabIndex = 4;
this.label5.Text = "聯(lián)系人:";
this.label5.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// groupBox2
//
this.groupBox2.Controls.Add(this.textBox6);
this.groupBox2.Location = new System.Drawing.Point(288, 40);
this.groupBox2.Name = "groupBox2";
this.groupBox2.Size = new System.Drawing.Size(200, 168);
this.groupBox2.TabIndex = 5;
this.groupBox2.TabStop = false;
this.groupBox2.Text = "公司簡(jiǎn)介";
//
// textBox6
//
this.textBox6.Location = new System.Drawing.Point(16, 24);
this.textBox6.Multiline = true;
this.textBox6.Name = "textBox6";
this.textBox6.Size = new System.Drawing.Size(168, 128);
this.textBox6.TabIndex = 7;
this.textBox6.TabStop = false;
this.textBox6.Text = "";
//
// button1
//
this.button1.Location = new System.Drawing.Point(16, 312);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(70, 23);
this.button1.TabIndex = 0;
this.button1.Text = "第一條";
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// button2
//
this.button2.Location = new System.Drawing.Point(92, 312);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(70, 23);
this.button2.TabIndex = 6;
this.button2.Text = "<<";
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// button3
//
this.button3.Location = new System.Drawing.Point(168, 312);
this.button3.Name = "button3";
this.button3.Size = new System.Drawing.Size(70, 23);
this.button3.TabIndex = 7;
this.button3.Text = ">>";
this.button3.Click += new System.EventHandler(this.button3_Click);
//
// button4
//
this.button4.Location = new System.Drawing.Point(244, 312);
this.button4.Name = "button4";
this.button4.Size = new System.Drawing.Size(70, 23);
this.button4.TabIndex = 8;
this.button4.Text = "最后一條";
this.button4.Click += new System.EventHandler(this.button4_Click);
//
// button5
//
this.button5.Location = new System.Drawing.Point(396, 312);
this.button5.Name = "button5";
this.button5.Size = new System.Drawing.Size(70, 23);
this.button5.TabIndex = 9;
this.button5.Text = "修改";
this.button5.Click += new System.EventHandler(this.button5_Click);
//
// button6
//
this.button6.Location = new System.Drawing.Point(320, 312);
this.button6.Name = "button6";
this.button6.Size = new System.Drawing.Size(70, 23);
this.button6.TabIndex = 10;
this.button6.Text = "添加 ";
this.button6.Click += new System.EventHandler(this.button6_Click);
//
// button7
//
this.button7.Location = new System.Drawing.Point(472, 312);
this.button7.Name = "button7";
this.button7.Size = new System.Drawing.Size(70, 23);
this.button7.TabIndex = 11;
this.button7.Text = "刪除";
this.button7.Click += new System.EventHandler(this.button7_Click);
//
// lbDno
//
this.lbDno.Location = new System.Drawing.Point(496, 216);
this.lbDno.Name = "lbDno";
this.lbDno.Size = new System.Drawing.Size(16, 16);
this.lbDno.TabIndex = 12;
//
// FMdanwei
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(554, 344);
this.Controls.Add(this.button7);
this.Controls.Add(this.button6);
this.Controls.Add(this.button5);
this.Controls.Add(this.button4);
this.Controls.Add(this.button3);
this.Controls.Add(this.button2);
this.Controls.Add(this.button1);
this.Controls.Add(this.groupBox1);
this.Controls.Add(this.label1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
this.Name = "FMdanwei";
this.Text = "FMdanwei";
this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
this.Load += new System.EventHandler(this.FMdanwei_Load);
this.groupBox1.ResumeLayout(false);
this.groupBox2.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private void FMdanwei_Load(object sender, System.EventArgs e)
{
Display();
index=this.BindingContext[ds,"Ddaiwei"];
}
private void Display()
{
string mystr="workstation id=\"GHX-82E19EF0633\";packet size=4096;integrated security=SSPI;data s" +
"ource=\".\";persist security info=False;initial catalog=zhaopin";
SqlConnection con=new SqlConnection(mystr);
try
{
string sql="select * from Ddaiwei";
con.Open();
SqlDataAdapter myad=new SqlDataAdapter(sql,con);
ds=new DataSet();
myad.Fill(ds,"Ddaiwei");
}
catch(Exception oe)
{
MessageBox.Show(oe.Message,"Error");
}
finally
{
if(con.State==ConnectionState.Open)
con.Close();
}
this.textBox1.DataBindings.Add("Text",ds,"Ddaiwei.Dname");
this.textBox2.DataBindings.Add("Text",ds,"Ddaiwei.Dmark");
this.textBox3.DataBindings.Add("Text",ds,"Ddaiwei.Demail");
this.textBox4.DataBindings.Add("Text",ds,"Ddaiwei.Dlixiren");
this.textBox5.DataBindings.Add("Text",ds,"Ddaiwei.Dtel");
this.textBox6.DataBindings.Add("Text",ds,"Ddaiwei.Ditem");
this.lbDno.DataBindings.Add("Text",ds,"Ddaiwei.Dno");
}
private void button3_Click(object sender, System.EventArgs e)
{
if(this.index.Position==this.index.Count-1)
this.index.Position=0;
else
this.index.Position+=1;
}
private void button2_Click(object sender, System.EventArgs e)
{
if(this.index.Position==0)
this.index.Position=this.index.Count-1;
else
this.index.Position-=1;
}
private void button1_Click(object sender, System.EventArgs e)
{
this.index.Position=0;
}
private void button4_Click(object sender, System.EventArgs e)
{
this.index.Position=this.index.Count-1;
}
private void button6_Click(object sender, System.EventArgs e)
{
Form f1=new FMADD();
f1.Show();
}
private void button5_Click(object sender, System.EventArgs e)
{
string mystr="workstation id=\"GHX-82E19EF0633\";packet size=4096;integrated security=SSPI;data s" +
"ource=\".\";persist security info=False;initial catalog=zhaopin";
SqlConnection con=new SqlConnection(mystr);
try
{
//MessageBox.Show(this.ds.R);
string sql="update Ddaiwei set Dname='"+this.textBox1.Text.Trim()+"', Dmark='"+this.textBox2.Text.Trim()+"',Demail='"+
this.textBox3.Text.Trim()+"',Dlixiren='"+this.textBox4.Text.Trim()+"',Dtel='"+this.textBox5.Text.Trim()+"',Ditem='"
+this.textBox6.Text.Trim()+"'where Dno='"+this.lbDno.Text.Trim()+"'";
SqlCommand com=new SqlCommand(sql,con);
con.Open();
int i=com.ExecuteNonQuery();
if(i>0)
MessageBox.Show("修改記錄成功!");
}
catch(Exception oe)
{
MessageBox.Show(oe.Message,"Error");
}
finally
{
if(con.State==ConnectionState.Open)
con.Close();
}
}
private void button7_Click(object sender, System.EventArgs e)
{
string mystr="workstation id=\"GHX-82E19EF0633\";packet size=4096;integrated security=SSPI;data s" +
"ource=\".\";persist security info=False;initial catalog=zhaopin";
SqlConnection con=new SqlConnection(mystr);
try
{
//MessageBox.Show(this.ds.R);
string sql="delete from Ddaiwei where Dno='"+this.lbDno.Text.Trim()+"'";
SqlCommand com=new SqlCommand(sql,con);
con.Open();
int i=com.ExecuteNonQuery();
if(i>0)
MessageBox.Show("修改記錄成功!");
}
catch(Exception oe)
{
MessageBox.Show(oe.Message,"Error");
}
finally
{
if(con.State==ConnectionState.Open)
con.Close();
}
}
}
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -