📄 form_kqsb.cs
字号:
this.textBox1.Size = new System.Drawing.Size(88, 21);
this.textBox1.TabIndex = 9;
this.textBox1.Text = "";
//
// label1
//
this.label1.Location = new System.Drawing.Point(16, 232);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(56, 16);
this.label1.TabIndex = 8;
this.label1.Text = "考试时间";
//
// cbo_zyfx
//
this.cbo_zyfx.Location = new System.Drawing.Point(80, 64);
this.cbo_zyfx.Name = "cbo_zyfx";
this.cbo_zyfx.Size = new System.Drawing.Size(208, 20);
this.cbo_zyfx.TabIndex = 7;
//
// lbl_zyfx
//
this.lbl_zyfx.Location = new System.Drawing.Point(16, 72);
this.lbl_zyfx.Name = "lbl_zyfx";
this.lbl_zyfx.Size = new System.Drawing.Size(56, 16);
this.lbl_zyfx.TabIndex = 6;
this.lbl_zyfx.Text = "专业方向";
//
// txt_zkzh
//
this.txt_zkzh.Location = new System.Drawing.Point(80, 264);
this.txt_zkzh.Name = "txt_zkzh";
this.txt_zkzh.ReadOnly = true;
this.txt_zkzh.Size = new System.Drawing.Size(208, 21);
this.txt_zkzh.TabIndex = 5;
this.txt_zkzh.Text = "";
//
// dtp_ksrq
//
this.dtp_ksrq.Location = new System.Drawing.Point(80, 184);
this.dtp_ksrq.Name = "dtp_ksrq";
this.dtp_ksrq.Size = new System.Drawing.Size(208, 21);
this.dtp_ksrq.TabIndex = 3;
//
// cbo_kskm
//
this.cbo_kskm.Location = new System.Drawing.Point(80, 104);
this.cbo_kskm.Name = "cbo_kskm";
this.cbo_kskm.Size = new System.Drawing.Size(208, 20);
this.cbo_kskm.TabIndex = 2;
//
// cbo_yxfx
//
this.cbo_yxfx.Location = new System.Drawing.Point(80, 24);
this.cbo_yxfx.Name = "cbo_yxfx";
this.cbo_yxfx.Size = new System.Drawing.Size(208, 20);
this.cbo_yxfx.TabIndex = 1;
this.cbo_yxfx.SelectedIndexChanged += new System.EventHandler(this.cbo_yxfx_SelectedIndexChanged);
//
// lbl_yxfx
//
this.lbl_yxfx.Location = new System.Drawing.Point(16, 32);
this.lbl_yxfx.Name = "lbl_yxfx";
this.lbl_yxfx.Size = new System.Drawing.Size(56, 16);
this.lbl_yxfx.TabIndex = 0;
this.lbl_yxfx.Text = "研修方向";
//
// lbl_kskm
//
this.lbl_kskm.Location = new System.Drawing.Point(16, 112);
this.lbl_kskm.Name = "lbl_kskm";
this.lbl_kskm.Size = new System.Drawing.Size(56, 16);
this.lbl_kskm.TabIndex = 0;
this.lbl_kskm.Text = "考试科目";
//
// lbl_ksdd
//
this.lbl_ksdd.Location = new System.Drawing.Point(16, 152);
this.lbl_ksdd.Name = "lbl_ksdd";
this.lbl_ksdd.Size = new System.Drawing.Size(56, 16);
this.lbl_ksdd.TabIndex = 0;
this.lbl_ksdd.Text = "考试地点";
//
// lbl_ksrq
//
this.lbl_ksrq.Location = new System.Drawing.Point(16, 192);
this.lbl_ksrq.Name = "lbl_ksrq";
this.lbl_ksrq.Size = new System.Drawing.Size(56, 16);
this.lbl_ksrq.TabIndex = 0;
this.lbl_ksrq.Text = "考试日期";
//
// lbl_zkzh
//
this.lbl_zkzh.Location = new System.Drawing.Point(16, 272);
this.lbl_zkzh.Name = "lbl_zkzh";
this.lbl_zkzh.Size = new System.Drawing.Size(56, 16);
this.lbl_zkzh.TabIndex = 0;
this.lbl_zkzh.Text = "准考证号";
//
// cbo_ksdd
//
this.cbo_ksdd.ItemHeight = 12;
this.cbo_ksdd.Location = new System.Drawing.Point(80, 144);
this.cbo_ksdd.Name = "cbo_ksdd";
this.cbo_ksdd.Size = new System.Drawing.Size(208, 20);
this.cbo_ksdd.TabIndex = 2;
//
// gpb_ExaI_memo
//
this.gpb_ExaI_memo.Controls.Add(this.txt_ExaI_memo);
this.gpb_ExaI_memo.Location = new System.Drawing.Point(472, 352);
this.gpb_ExaI_memo.Name = "gpb_ExaI_memo";
this.gpb_ExaI_memo.Size = new System.Drawing.Size(304, 72);
this.gpb_ExaI_memo.TabIndex = 23;
this.gpb_ExaI_memo.TabStop = false;
this.gpb_ExaI_memo.Text = "备注";
//
// txt_ExaI_memo
//
this.txt_ExaI_memo.AcceptsReturn = true;
this.txt_ExaI_memo.Location = new System.Drawing.Point(8, 16);
this.txt_ExaI_memo.Multiline = true;
this.txt_ExaI_memo.Name = "txt_ExaI_memo";
this.txt_ExaI_memo.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
this.txt_ExaI_memo.Size = new System.Drawing.Size(288, 48);
this.txt_ExaI_memo.TabIndex = 0;
this.txt_ExaI_memo.Text = "";
//
// cbo_stu_name
//
this.cbo_stu_name.Location = new System.Drawing.Point(88, 40);
this.cbo_stu_name.Name = "cbo_stu_name";
this.cbo_stu_name.Size = new System.Drawing.Size(136, 20);
this.cbo_stu_name.TabIndex = 7;
this.cbo_stu_name.SelectedIndexChanged += new System.EventHandler(this.cbo_stu_name_SelectedIndexChanged);
//
// txt_stu_id
//
this.txt_stu_id.Location = new System.Drawing.Point(184, 16);
this.txt_stu_id.Name = "txt_stu_id";
this.txt_stu_id.Size = new System.Drawing.Size(80, 21);
this.txt_stu_id.TabIndex = 24;
this.txt_stu_id.Text = "";
this.txt_stu_id.Visible = false;
//
// Form_kqsb
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(792, 573);
this.Controls.Add(this.txt_stu_id);
this.Controls.Add(this.gpb_ExaI_memo);
this.Controls.Add(this.btn_tj);
this.Controls.Add(this.gpb_stu_mes);
this.Controls.Add(this.btn_dy);
this.Controls.Add(this.btn_cx);
this.Controls.Add(this.gpb_exam_mes);
this.Name = "Form_kqsb";
this.Text = "考前申报";
this.Load += new System.EventHandler(this.Form_kqsb_Load);
this.gpb_stu_mes.ResumeLayout(false);
this.gpb_exam_mes.ResumeLayout(false);
this.gpb_ExaI_memo.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private void Form_kqsb_Load(object sender, System.EventArgs e)
{
this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
this.ControlBox = false;
string sql_yxfx = "select sub_name from subject";//研修方向
string sql_zyfx = "select spe_name from speciality,subject where subject.sub_no=speciality.sub_no";//专业方向
string sql_kskm = "select cou_name from course,knowledgesystem,speciality where course.cou_no=knowledgesystem.cou_no and knowledgesystem.spe_no=speciality.spe_no";//考试科目
string sql_ksdd = "select add_name from examInfo,address where examInfo.add_code=address.add_code";//考试地点
// string sql_ExaI_memo="select ExaI_memo from examInfo";//备注
SqlConnection con1 = new SqlConnection();
con1.ConnectionString=db.connStr;
con1.Open();
SqlCommand cmd1=new SqlCommand();
cmd1.Connection=con1;
SqlDataReader Read1;
cmd1.CommandText="select stu_name from student";//查询学员姓名
Read1=cmd1.ExecuteReader();
while(Read1.Read())
{
cbo_stu_name.Items.Add(Read1["stu_name"].ToString());
}
Read1.Close();
cmd1.CommandText=sql_yxfx;//研修方向
Read1=cmd1.ExecuteReader();
while(Read1.Read())
{
cbo_yxfx.Items.Add(Read1["sub_name"].ToString());
}
Read1.Close();
cmd1.CommandText = sql_zyfx;//专业方向
Read1 =cmd1.ExecuteReader();
while( Read1.Read())
{
cbo_zyfx.Items.Add(Read1["spe_name"].ToString());
}
Read1.Close();
cmd1.CommandText = sql_kskm;//考试科目
Read1 = cmd1.ExecuteReader();
while( Read1.Read())
{
cbo_kskm.Items.Add(Read1["cou_name"].ToString());
}
Read1.Close();
cmd1.CommandText = sql_ksdd;//考试地点
Read1 = cmd1.ExecuteReader();
while( Read1.Read())
{
cbo_ksdd.Items.Add(Read1["add_name"].ToString());
}
Read1.Close();
// cmd1.CommandText = sql_ExaI_memo;//备注
// Read1 = cmd1.ExecuteReader();
// while( Read1.Read())
// {
// txt_ExaI_memo.Text=Read1["ExaI_memo"].ToString();
// }
// Read1.Close();
}
private void cbo_yxfx_SelectedIndexChanged(object sender, System.EventArgs e)
{
cbo_zyfx.Items.Clear();
string selectItem = cbo_yxfx.SelectedItem.ToString();
// SqlCommand keDr = new SqlCommand();
// keDr.Connection=mySqlcnt;
// keDr.CommandText=sql_zyfx + "where subject.sub_no=speciality.sub_no and subject.sub_name=" +"'"+selectItem + "'";
// SqlDataReader kechenDr;
// kechenDr=keDr.ExecuteReader();
// while(kechenDr.Read())
// {
// cbo_zyfx.Items.Add(kechenDr["spe_name"].ToString());
// }
// kechenDr.Close();
}
private void btn_cx_Click(object sender, System.EventArgs e)
{
SqlConnection con2 = new SqlConnection();
con2.ConnectionString=db.connStr;
con2.Open();
SqlCommand cmd2=new SqlCommand();
cmd2.Connection=con2;
SqlDataReader Read2;
string sql_cx1="SELECT stu_id,sex_name,nat_name,stu_identityno,stu_tel,stu_email,stu_address,stu_college,stu_diploma,stu_photo "+
" FROM student,nation,sex WHERE student.sex_code=sex.sex_code AND student.nat_code=nation.nat_code AND student.stu_name="+ "'"+ cbo_stu_name.Text + "'";//查询条件1
txt_stu_sex.Text="";
txt_nat.Text="";
txt_stu_identityno.Text="";
txt__stu_tel.Text="";
txt_stu_email.Text="";
txt_stu_address.Text="";
txt__stu_college.Text="";
txt_stu_diploma.Text="";
//pic_stu_img.Image="";
cbo_yxfx.Text="";
cbo_zyfx.Text="";
cbo_kskm.Text="";
cbo_ksdd.Text="";
txt_zkzh.Text="";
txt_stu_id.Text="";
if (cbo_stu_name.Text=="")
{
MessageBox.Show("请在学员信息框内输入学员姓名!","系统提示",MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
else
{
cmd2.CommandText = sql_cx1;//查询条件1
Read2 = cmd2.ExecuteReader();
if (Read2.Read())
{
txt_stu_id.Text=Read2["stu_id"].ToString();
txt_stu_sex.Text = Read2["sex_name"].ToString();
txt_nat.Text= Read2["nat_name"].ToString();
txt_stu_identityno.Text=Read2["stu_identityno"].ToString();
txt__stu_tel.Text=Read2["stu_tel"].ToString();
txt_stu_email.Text=Read2["stu_email"].ToString();
txt_stu_address.Text=Read2["stu_address"].ToString();
txt__stu_college.Text=Read2["stu_college"].ToString();
txt_stu_diploma.Text=Read2["stu_diploma"].ToString();
//pic_stu_img.Image=myDR["stu_photo"].ToString();
if (txt_stu_sex.Text=="a")
{
txt_stu_sex.Text="男";
}
else
{
txt_stu_sex.Text="女";
}
}
else
{
MessageBox.Show("没有该学员!请检查您输入的姓名是否正确。","系统提示",MessageBoxButtons.OK, MessageBoxIcon.Warning);
}Read2.Close();
}
string sql_cx2="SELECT sub_name,spe_name,cou_name,add_name,exaI_examTime,exaI_licenceNo FROM subject sub,speciality spe,course cou,examInfo exa,knowledgeSystem ks,address addr WHERE sub.sub_no=spe.sub_no and spe.spe_no=ks.spe_no and ks.cou_no=cou.cou_no and addr.add_code=exa.add_code and cou.cou_no=exa.cou_no and exa.stu_id=" + "'" + txt_stu_id.Text + "'";//查询条件2
cmd2.CommandText = sql_cx2;//查询条件2
Read2 = cmd2.ExecuteReader();
while(Read2.Read())
{
cbo_yxfx.Text=Read2["sub_name"].ToString();
cbo_zyfx.Text=Read2["spe_name"].ToString();
cbo_kskm.Text=Read2["cou_name"].ToString();
cbo_ksdd.Text=Read2["add_name"].ToString();
txt_zkzh.Text=Read2["exaI_licenceNo"].ToString();
}Read2.Close();
}
private void btn_tj_Click(object sender, System.EventArgs e)
{
MessageBox.Show("提交成功!","考前申报",MessageBoxButtons.OK,MessageBoxIcon.Information);
}
private void cbo_stu_name_SelectedIndexChanged(object sender, System.EventArgs e)
{
SqlConnection con1 = new SqlConnection();
con1.ConnectionString=db.connStr;
con1.Open();
SqlCommand cmd1=new SqlCommand();
cmd1.Connection=con1;
SqlDataReader Read1;
txt_stu_sex.Text="";
txt_nat.Text="";
txt_stu_identityno.Text="";
txt__stu_tel.Text="";
txt_stu_email.Text="";
txt_stu_address.Text="";
txt__stu_college.Text="";
txt_stu_diploma.Text="";
cbo_yxfx.Text="";
cbo_zyfx.Text="";
cbo_kskm.Text="";
cbo_ksdd.Text="";
txt_zkzh.Text="";
txt_stu_id.Text="";
//pic_stu_img.Image="";
string sql_cx1="SELECT stu_id,sex_name,nat_name,stu_identityno,stu_tel,stu_email,stu_address,stu_college,stu_diploma,stu_photo "+
" FROM student,nation,sex WHERE student.sex_code=sex.sex_code AND student.nat_code=nation.nat_code AND student.stu_name="+ "'"+ cbo_stu_name.Text + "'";//查询条件1
cmd1.CommandText = sql_cx1;//查询条件1
Read1 = cmd1.ExecuteReader();
while(Read1.Read())
{
txt_stu_id.Text=Read1["stu_id"].ToString();
txt_stu_sex.Text = Read1["sex_name"].ToString();
txt_nat.Text= Read1["nat_name"].ToString();
txt_stu_identityno.Text=Read1["stu_identityno"].ToString();
txt__stu_tel.Text=Read1["stu_tel"].ToString();
txt_stu_email.Text=Read1["stu_email"].ToString();
txt_stu_address.Text=Read1["stu_address"].ToString();
txt__stu_college.Text=Read1["stu_college"].ToString();
txt_stu_diploma.Text=Read1["stu_diploma"].ToString();
//pic_stu_img.Image=myDR["stu_photo"].ToString();
if (txt_stu_sex.Text=="a")
{
txt_stu_sex.Text="男";
}
else
{
txt_stu_sex.Text="女";
}
}Read1.Close();
string sql_cx2="SELECT sub_name,spe_name,cou_name,add_name,exaI_examTime,exaI_licenceNo FROM subject sub,speciality spe,course cou,examInfo exa,knowledgeSystem ks,address addr WHERE sub.sub_no=spe.sub_no AND spe.spe_no=ks.spe_no and ks.cou_no=cou.cou_no AND addr.add_code=exa.add_code AND cou.cou_no=exa.cou_no AND exa.stu_id=" + "'" +txt_stu_id.Text + "'";//查询条件2
cmd1.CommandText = sql_cx2;//查询条件2
Read1 = cmd1.ExecuteReader();
while(Read1.Read())
{
cbo_yxfx.Text=Read1["sub_name"].ToString();
cbo_zyfx.Text=Read1["spe_name"].ToString();
cbo_kskm.Text=Read1["cou_name"].ToString();
cbo_ksdd.Text=Read1["add_name"].ToString();
txt_zkzh.Text=Read1["exaI_licenceNo"].ToString();
}Read1.Close();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -