?? fm_nos.cs
字號:
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Data.SqlClient;
namespace 招聘考試成績管理系統(tǒng)
{
/// <summary>
/// Fm_nos 的摘要說明。
/// </summary>
public class Fm_nos : System.Windows.Forms.Form
{
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.Button btquery;
private System.Windows.Forms.ComboBox comboBox;
private System.Windows.Forms.TextBox textBox1;
private System.Data.SqlClient.SqlConnection sqlConnection1;
private System.Data.SqlClient.SqlCommand sqlCommand1;
private System.Windows.Forms.DataGrid dataGrid1;
private System.Data.SqlClient.SqlDataAdapter sqlDataAdapter1;
private 招聘考試成績管理系統(tǒng).DataSet1 dataSet11;
private System.Data.SqlClient.SqlCommand sqlSelectCommand1;
private System.Data.SqlClient.SqlCommand sqlInsertCommand1;
/// <summary>
/// 必需的設(shè)計器變量。
/// </summary>
private System.ComponentModel.Container components = null;
public Fm_nos()
{
//
// Windows 窗體設(shè)計器支持所必需的
//
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è)計器生成的代碼
/// <summary>
/// 設(shè)計器支持所需的方法 - 不要使用代碼編輯器修改
/// 此方法的內(nèi)容。
/// </summary>
private void InitializeComponent()
{
this.label2 = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.btquery = new System.Windows.Forms.Button();
this.comboBox = new System.Windows.Forms.ComboBox();
this.textBox1 = new System.Windows.Forms.TextBox();
this.sqlConnection1 = new System.Data.SqlClient.SqlConnection();
this.sqlCommand1 = new System.Data.SqlClient.SqlCommand();
this.dataGrid1 = new System.Windows.Forms.DataGrid();
this.dataSet11 = new 招聘考試成績管理系統(tǒng).DataSet1();
this.sqlDataAdapter1 = new System.Data.SqlClient.SqlDataAdapter();
this.sqlSelectCommand1 = new System.Data.SqlClient.SqlCommand();
this.sqlInsertCommand1 = new System.Data.SqlClient.SqlCommand();
((System.ComponentModel.ISupportInitialize)(this.dataGrid1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.dataSet11)).BeginInit();
this.SuspendLayout();
//
// label2
//
this.label2.Font = new System.Drawing.Font("華文楷體", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(134)));
this.label2.Location = new System.Drawing.Point(184, 24);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(136, 24);
this.label2.TabIndex = 6;
this.label2.Text = "考生成績查詢";
//
// label4
//
this.label4.Location = new System.Drawing.Point(240, 64);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(56, 16);
this.label4.TabIndex = 12;
this.label4.Text = "關(guān)鍵字:";
//
// label3
//
this.label3.Location = new System.Drawing.Point(40, 64);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(56, 16);
this.label3.TabIndex = 11;
this.label3.Text = "查詢類型:";
//
// btquery
//
this.btquery.Location = new System.Drawing.Point(432, 56);
this.btquery.Name = "btquery";
this.btquery.TabIndex = 10;
this.btquery.Text = "查詢";
this.btquery.Click += new System.EventHandler(this.btquery_Click);
//
// comboBox
//
this.comboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comboBox.ForeColor = System.Drawing.SystemColors.WindowFrame;
this.comboBox.Items.AddRange(new object[] {
"準考證號碼",
"總分"});
this.comboBox.Location = new System.Drawing.Point(104, 56);
this.comboBox.Name = "comboBox";
this.comboBox.Size = new System.Drawing.Size(121, 20);
this.comboBox.Sorted = true;
this.comboBox.TabIndex = 9;
//
// textBox1
//
this.textBox1.Location = new System.Drawing.Point(312, 56);
this.textBox1.Name = "textBox1";
this.textBox1.TabIndex = 8;
this.textBox1.Text = "";
//
// sqlConnection1
//
this.sqlConnection1.ConnectionString = "workstation id=\"GHX-82E19EF0633\";packet size=4096;integrated security=SSPI;data s" +
"ource=\".\";persist security info=False;initial catalog=zhaopin";
//
// sqlCommand1
//
this.sqlCommand1.CommandText = "SELECT * FROM mark_no";
this.sqlCommand1.Connection = this.sqlConnection1;
//
// dataGrid1
//
this.dataGrid1.CaptionVisible = false;
this.dataGrid1.DataMember = "";
this.dataGrid1.DataSource = this.dataSet11.mark_no;
this.dataGrid1.HeaderForeColor = System.Drawing.SystemColors.ControlText;
this.dataGrid1.Location = new System.Drawing.Point(32, 96);
this.dataGrid1.Name = "dataGrid1";
this.dataGrid1.ReadOnly = true;
this.dataGrid1.Size = new System.Drawing.Size(489, 224);
this.dataGrid1.TabIndex = 13;
//
// dataSet11
//
this.dataSet11.DataSetName = "DataSet1";
this.dataSet11.Locale = new System.Globalization.CultureInfo("zh-CN");
//
// sqlDataAdapter1
//
this.sqlDataAdapter1.InsertCommand = this.sqlInsertCommand1;
this.sqlDataAdapter1.SelectCommand = this.sqlSelectCommand1;
this.sqlDataAdapter1.TableMappings.AddRange(new System.Data.Common.DataTableMapping[] {
new System.Data.Common.DataTableMapping("Table", "mark_no", 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("總分", "總分")})});
//
// sqlSelectCommand1
//
this.sqlSelectCommand1.CommandText = "SELECT 準考證號, 姓名, 英語, 語文, 政治, 總分 FROM mark_no";
this.sqlSelectCommand1.Connection = this.sqlConnection1;
//
// sqlInsertCommand1
//
this.sqlInsertCommand1.CommandText = "INSERT INTO mark_no(準考證號, 姓名, 英語, 語文, 政治, 總分) VALUES (@準考證號, @姓名, @英語, @語文, @政治, " +
"@總分); SELECT 準考證號, 姓名, 英語, 語文, 政治, 總分 FROM mark_no";
this.sqlInsertCommand1.Connection = this.sqlConnection1;
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@準考證號", System.Data.SqlDbType.VarChar, 6, "準考證號"));
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@姓名", System.Data.SqlDbType.VarChar, 10, "姓名"));
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@英語", System.Data.SqlDbType.Int, 4, "英語"));
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@語文", System.Data.SqlDbType.Int, 4, "語文"));
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@政治", System.Data.SqlDbType.Int, 4, "政治"));
this.sqlInsertCommand1.Parameters.Add(new System.Data.SqlClient.SqlParameter("@總分", System.Data.SqlDbType.Int, 4, "總分"));
//
// Fm_nos
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(558, 364);
this.Controls.Add(this.dataGrid1);
this.Controls.Add(this.label4);
this.Controls.Add(this.label3);
this.Controls.Add(this.btquery);
this.Controls.Add(this.comboBox);
this.Controls.Add(this.textBox1);
this.Controls.Add(this.label2);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
this.Name = "Fm_nos";
this.Text = "Fm_nos";
this.WindowState = System.Windows.Forms.FormWindowState.Maximized;
this.Load += new System.EventHandler(this.Fm_nos_Load);
((System.ComponentModel.ISupportInitialize)(this.dataGrid1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.dataSet11)).EndInit();
this.ResumeLayout(false);
}
#endregion
private void Fm_nos_Load(object sender, System.EventArgs e)
{
this.comboBox.SelectedIndex =0;
sqlDataAdapter1.Fill(dataSet11,"mark_no");
}
private void btquery_Click(object sender, System.EventArgs e)
{
try
{
if(this.textBox1.Text.Trim()=="")
return;
string str ="select * from mark_no ";
if(this.comboBox.SelectedIndex==0)
str += "where 準考證號 = "+this.textBox1.Text;
else
str += "where 總分 = "+this.textBox1.Text;
this.sqlCommand1.CommandType=CommandType.Text;
this.sqlDataAdapter1.SelectCommand = sqlCommand1;
sqlCommand1.CommandText=str;
dataSet11.Clear();
sqlDataAdapter1.Fill(dataSet11,"mark_no");
}
catch(Exception oe)
{
this.textBox1.Text=oe.Message;
MessageBox.Show(oe.Message,"Error");
}
}
}
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -