• 上機實習報告總結結尾

    時間:2022-07-05 09:00:57 實習報告 我要投稿
    • 相關推薦

    上機實習報告總結結尾

    一. 首頁

    上機實習報告總結結尾

    代碼如下;

    using System;

    using System.Collections.Generic;

    using System.ComponentModel;

    using System.Data;

    using System.Drawing;

    using System.Text;

    using System.Windows.Forms;

    namespace WindowsApplication1

    {

    public partial class Form5 : Form {

    public Form5()

    {

    InitializeComponent();

    }

    private void button1_Click(object sender, {

    logo from = new logo();

    from.Show(); EventArgs e)

    }

    private void button2_Click(object sender, EventArgs e) {

    Form2 from = new Form2();

    from.Show();

    }

    private void button3_Click(object sender, EventArgs e)http://www.xielw.cn/shijuan/ 試卷 {

    Form3 from = new Form3();

    from.Show();

    }

    private void button4_Click(object sender, EventArgs e) {

    Form4 from = new Form4();

    from.Show();

    }

    }

    }

    二. 登錄模塊

    代碼如下:

    using System;

    using System.Collections.Generic;

    using System.ComponentModel;

    using System.Data;

    using

    System.Data.SqlClient;

    using System.Drawing;

    using System.Text;

    using System.Windows.Forms;

    namespace WindowsApplication1

    {

    public partial class logo : Form

    {

    public logo()

    {

    InitializeComponent();

    }

    private void Form1_Load(object sender, EventArgs e)

    {

    }

    private void button1_Click(object sender, EventArgs e) {

    string connstring = @"Data Source=panlunzhao;Initial Catalog=BOOKSTORE.MDF;Integrated Security=True";

    SqlConnection conn = new SqlConnection(connstring); conn.Open();

    string username = this.username.Text.ToString(); string password = this.password.Text.ToString(); SqlCommand comm = conn.CreateCommand();

    comm.CommandText = "select * from manage where username='" + username + "' and password='" + password + "'";

    SqlDataReader sqlda = comm.ExecuteReader();

    if (sqlda.Read())

    {

    ifhttp://www.xielw.cn/gongzuobaogao/ 工作報告 (sqlda["password"].ToString().Trim() == password) {

    //MessageBox.Show("恭喜您登陸成功!", "登陸成功!", MessageBoxButtons.OK, MessageBoxIcon.Information);

    //Form2 f = new Form2();

    //f.Show();

    Form3 from = new Form3();

    from.Show();

    }

    else { MessageBox.Show("密碼錯誤,請重新輸入!", "錯誤

    ", MessageBoxButtons.OK, MessageBoxIcon.Information); }

    }

    else { MessageBox.Show("此用戶不存在,請您注冊!", "注冊", MessageBoxButtons.OK, MessageBoxIcon.Information); }

    conn.Close();http://www.xielw.cn/dangtuangongzuozongjie/ 黨團工作總結

    sqlda.Close();

    }

    private void button2_Click(object sender, EventArgs e) {

    username.Text = "";

    password.Text = "";

    }

    }

    }

    三. 會員管理模塊

    代碼如下:

    using System;

    using System.Collections.Generic;

    using System.ComponentModel;

    using System.Data;

    using System.Data.SqlClient;

    using System.Drawing;

    using System.Text;

    using System.Windows.Forms;

    namespace WindowsApplication1

    {

    public partial class Form2 :

    Form

    {

    protected SqlConnection conn;

    protected SqlCommand cmd;

    string connstring = @"Data Souhttp://www.isfinland.com/article/ 述職報告rce=panlunzhao;Initial Catalog=BOOKSTORE.MDF;Integrated Security=True";

    public Form2()

    {

    InitializeComponent();

    }

    private void Form2_Load(object sender, EventArgs e)

    {

    load1();

    load();

    }

    protected void load1()

    {

    string sql = "select *from customer";

    conn = new SqlConnection(connstring);

    conn.Open();

    SqlDataAdapter da = new SqlDataAdapter(sql, conn); DataSet ds = new DataSet();

    da.Fill(ds, "book");

    dataGridView1.DataSource = ds.Tables["book"];

    }

    protected void load()

    {

    conn = new SqlConnection(connstring);

    conn.Open();

    string sql_select = "SELECT ID FROM customer "; cmd = new SqlCommand(sql_select, conn);

    SqlDataReader dr = cmd.ExecuteReader();

    id.Items.Clear();

    while (dr.Read())

    id.Items.Add(dr[0]);

    dr.Close();

    }

    private DataTable BindData(string sql)

    {

    string sql_select = sql;

    conn = new SqlConnection(connstring);

    SqlDataAdapter ad = new SqlDataAdapter(sql_select, conn); DataSet ds = new DataSet();

    ad.Fill(ds, "customer");

    return ds.Tables["customer"];

    }

    private void button1_Click(object sender, EventArgs e) {

    string sql = "select * from customer where ID='" + id.Text.ToString() + "'";

    conn = new SqlConnection(connstring);

    conn.Open();

    SqlCommand cmd = new SqlCommand(sql, conn);

    SqlDataReader ds = cmd.ExecuteReader();

    ds.Read();

    textBox1.Text = ds["name"].ToString();

    textBox2.Text http://www.xielw.cn/xuexiaogongzuozongjie/ 學校工作總結 = ds["Levels"].ToString();

    textBox3.Text = ds["Birthday"].ToString();

    textBox4.Text = ds["Degree"].ToString();

    textBox5.Text = ds["Address"].ToString();

    textBox6.Text = ds["Telephone"].ToString();

    textBox7.Text = ds["Email"].ToString();

    textBox8.Text = ds["Score"].ToString();

    radioButton1.Checked = (bool)ds["Gender"];

    }

    private void update_Click(object sender, EventArgs e) {

    string sql = "customer set

    name=@name,Levels=@Levels,Birthday=@Birthday,Degree=@Degree,Address=@Address,Telephone=@Telephone,Email=@Email,Score=@Score where ID=@ID"; conn = new SqlConnection(connstring);

    conn.Open();

    cmd = new SqlCommand(sql, conn);

    cmd.Parameters.Add("@ID", SqlDbType.Int).Value = id.Text.ToString();

    cmd.Parameters.Add("@name", SqlDbType.NVarChar, 20).Value = textBox1.Text.Trim();

    cmd.Parameters.Add("@Levels", SqlDbType.SmallInt).Value = textBox2.Text.Trim();

    cmd.Parameters.Add("@Birthday",

    SqlDbType.SmallDateTime).Value = textBox3.Text.Trim();

    cmd.Parameters.Add("@Degree", SqlDbType.NVarChar,

    20).Value = textBox4.Text.Trim();

    cmd.Parameters.Add("@Address", SqlDbType.NVarChar, 256).Value = textBox5.Text.Trim();

    cmd.Parameters.Add("@Telephone", SqlDbType.NVarChar,

    50).Value = textBox6.Text.Trim();

    cmd.Parameters.Add("@Email", SqlDbType.NVarChar, 50).Value = textBox7.Text.Trim();

    cmd.Parameters.Add("http://www.xielw.cn/yundonghuiyanjianggao/ 運動會演講稿 @Gender", SqlDbType.Bit).Value = (bool)radioButton1.Checked;

    cmd.Parameters.Add("@Score", SqlDbType.Int).Value = textBox8.Text.Trim();

    cmd.ExecuteNonQuery();

    SqlDataReader ds = cmd.ExecuteReader();

    ds.Read();

    load1();

    }

    private void _Click(object sender, EventArgs e) {

    string sql_ = " into

    customer(Name,Levels,Gender,Birthday,Degree,Address,Telephone,Email,Score)

    values(@Name,@Levels,@Gender,@Birthday,@Degree,@Address,@Telephone,@Email,@Score)";

    cmd = new SqlCommand(sql_, conn);

    try

    {

    conn.Open();

    cmd.Parameters.Add("@Name", SqlDbType.NVarChar,

    20).Value = textBox1.Text.Trim();

    cmd.Parameters.Add("@Levels",

    SqlDbType.SmallInt).Value = Convert.ToDouble(textBox2.Text.Trim()); cmd.Parameters.Add("@Birthday",

    SqlDbType.SmallDateTime).Value =

    Convert.ToDateTime(textBox3.Text.Trim());

    cmd.Parameters.Add("@Degree", SqlDbType.NVarChar,

    20).Value = textBox4.Text.Trim();

    cmd.Parameters.Add("@Address", SqlDbType.NVarChar, 256).Value = textBox5.Text.Trim();

    cmd.Parameters.Add("@Telephone", SqlDbType.NVarChar,

    50).Value = textBox6.Text.Trim();

    cmd.Parameters.Add("@Email", SqlDbType.NVarChar,

    50).Value = textBox7.Text.Trim();

    cmd.Parameters.Add("@Score", SqlDbType.Int).Value = Convert.ToDouble(textBox8.Text.Trim());

    if (radioButton1.Checked)

    {

    cmd.Parameters.Add("@Gender",

    SqlDbType.Bit).Value = "true";

    }

    else

    {

    cmd.Parameters.Add("@Gender",

    SqlDbType.Bit).Valuhttp://www.xielw.cn/yuegongzuozongjie/ 月工作總結 e = "false";

    }

    int count = cmd.ExecuteNonQuery();

    if (count == 1)

    {

    if (MessageBox.Show("確認添加讀者嗎?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) return;

    MessageBox.Show("添加成功!!", "提示!"); }

    else

    {

    MessageBox.Show("添加失敗", "提示",

    MessageBoxButtons.RetryCancel, MessageBoxIcon.Information);

    }

    }

    catch (Exception ex)

    {

    MessageBox.Show(ex.Message);

    }

    finally

    {

    conn.Close();

    }

    }

    }

    }

    四.增加、刪除、修改圖書模塊

    代碼如下:

    using System;

    using System.Collections.Generic;

    using System.ComponentModel;

    using System.Data;

    using System.Data.SqlClient;

    using System.Drawing;

    using System.Text;

    using System.Windows.Forms;

    namespace WindowsApplication1

    {

    public partial class Form3 : Form

    {

    protected SqlConnection conn;

    protected SqlComhttp://www.xielw.cn/shijicailiao/ 事跡材料mand cmd;

    string connstring = @"Data Source=panlunzhao;Initial Catalog=BOOKSTORE.MDF;Integrated Security=True";

    public Form3()

    {

    InitializeComponent();

    }

    private void textBox7_TextChanged(object sender, EventArgs e) {

    }

    private void label6_Click(object sender, EventArgs e) {

    }

    private void select_Click(object sender, EventArgs e) {

    string book_name = shuming.Text.Trim();

    string press = chubanshe.Text.ToString();

    string Author = duzhe.Text.Trim();

    StringBuilder sb1 = new StringBuilder();

    sb1.Append("select * from book where ");

    if (checkBox1.Checked)

    sb1.Append(string.Format("Name LIKE '%{0}%'", book_name));

    if (checkBox1.Checked && checkBox2.Checked) sb1.Append("AND ");

    if (checkBox2.Checked)

    {

    sb1.Append(string.Format("Press = '{0}'", press)); }

    if (checkBox3.Checked && checkBox2.Checked) sb1.Append("AND ");

    if (checkBox3.Checked)

    {

    sb1.Append(string.Format("Author LIKE '%{0}%'", Author));

    }

    dataGridView1.DataSource = Binhttp://www.xielw.cn/banzhurengongzuojihua/ 班主任工作計劃 dData(sb1.ToString()); }

    private void reset_Click(object sender, EventArgs e) {

    checkBox1.Checked = true;

    checkBox2.Checked = false;

    checkBox3.Checked = false;

    shuming.Text = "";

    chubanshe.Text = "";

    duzhe.Text = "";

    }

    private void button1_Click(object sender, EventArgs e) {

    string sql = "select * from book where ISBN='" + comboBox1.Text.ToString() + "'";

    conn = new SqlConnection(connstring);

    conn.Open();

    SqlCommand cmd = new SqlCommand(sql, conn);

    SqlDataReader ds = cmd.ExecuteReader();

    ds.Read();

    textBox1.Text = ds["ISBN"].ToString();

    textBox2.Text = ds["name"].ToString();

    textBox3.Text = ds["author"].ToString();

    textBox4.Text = ds["press"].ToString();

    textBox5.Text = ds["publishdate"].ToString(http://www.xielw.cn/shiyongqigongzuozongjie/ 試用期工作總結 );

    textBox6.Text = ds["price"].ToString();

    textBox7.Text = ds["pages"].ToString();

    textBox8.Text = ds["barcode"].ToString();

    radioButton1.Checked = (bool)ds["cd"];

    textBox10.Text = ds["storage"].ToString();

    }

    private void button2_Click(object sender, EventArgs e) {

    string sql = " into

    book(ISBN,name,author,press,publishdate,price,pages,barcode,cd,storage)

    values(@ISBN,@name,@author,@press,@publishdate,@price,@pages,@barcode,@cd,@storage)";

    conn = new SqlConnection(connstring);

    conn.Open();

    cmd = new SqlCommand(sql, conn);

    cmd.Parameters.Add("@isbn", SqlDbType.NChar, 10).Value = textBox1.Text.ToString();

    cmd.Parameters.Add("@name", SqlDbType.NVarChar, 256).Value = textBox2.Text.Trim();

    cmd.Parameters.Add("@author", SqlDbType.NVarChar, 100).Value = textBox3.Text.Trim();

    cmd.Parameters.Add("@press", SqlDbType.NVarChar, 50).Value = textBox4.Text.Trim();

    cmd.Parameters.Add("@publishdate", SqlDbType.NVarChar,

    50).Value = textBox5.Text.Trim();

    cmd.Parameters.Add("@price", SqlDbType.NVarChar, 50).Value = textBox6.Text.Trim();

    cmd.Parameters.Add("@pages", SqlDbType.NVarChar, 50).Value

    = textBox7.Text.Trim();

    cmd.Parameters.Add("@barcode", SqlDbTypehttp://www.xielw.cn/dangxiaoxuexixindetihui/ 黨校學習心得體會 .NVarChar,

    50).Value = textBox8.Text.Trim();

    cmd.Parameters.Add("@cd", SqlDbType.NVarChar, 50).Value = (bool)radioButton1.Checked;

    cmd.Parameters.Add("@storage", SqlDbType.NVarChar,

    50).Value = textBox10.Text.Trim();

    cmd.ExecuteNonQuery();

    load1();

    load();

    }

    private void save_Click(object sender, EventArgs e)

    {

    string sql = "book set

    name=@name,author=@author,press=@press,publishdate=@publishdate,price=@price,pages=@pages,barcode=@barcode,cd=@cd,Storage=@Storage where ISBN=@ISBN";

    conn = new SqlConnection(connstring);

    conn.Open();

    cmd = new SqlCommand(sql, conn);

    cmd.Parameters.Add("@isbn", SqlDbType.NChar, 10).Value = comboBox1.Text.ToString();

    cmd.Parameters.Add("@name", SqlDbType.NVarChar, 256).Value = textBox2.Text.Trim();

    cmd.Parameters.Add("@author", SqlDbType.NVarChar, 100).Value = textBox3.Text.Trim();

    cmd.Parameters.Add("@press", SqlDbType.NVarChar, 50).Value = textBox4.Text.Trim();

    cmd.Parameters.Add("@publishdate", SqlDbType.NVarChar,

    50).Value = textBox5.Text.Trim();

    cmd.Parameters.Add("@price", SqlDbType.NVarChar, 50).Value = textBox6.Text.Trim();

    cmd.Parameters.Add("@pages", SqlDbType.NVarChar, 50).Value = textBox7.Text.Trim();

    cmd.Parameters.Add("@barcode", SqlDbType.NVarChar,

    50).Value = textBox8.Text.Trim();

    cmd.Parameters.Add("@cd", SqlDbType.NVarChar, 50).Value = (bool)radioButton1.Checked;

    cmd.Parameters.Add("@storage", SqlDbType.NVarChar,

    50).Value = textBox10.Text.Trim();

    cmd.ExecuteNonQuery();

    SqlDataReader ds = cmd.ExecuteReader();

    ds.Read();

    load1();

    }

    private void quxiaosave_Click(object sender, EventArgs e) {

    textBox1.Text = "";

    textBox2.Text = "";

    textBox3.Text = "";

    textBox4.Text = "";

    textBox5.Text = "&http://www.xielw.cn/shenbaocailiao/ 申報材料quot;;

    textBox6.Text = "";

    textBox7.Text = "";

    textBox8.Text = "";

    radioButton1.Checked = false;

    textBox10.Text = "";

    }

    private void _Click(object sender, EventArgs e) {

    string sql = " from book where isbn=@isbn"; conn = new SqlConnection(connstring);

    cmd = new SqlCommand(sql, conn);

    conn.Open();

    cmd.Parameters.Add("@isbn", SqlDbType.NChar, 10).Value = comboBox1.Text.ToString();

    cmd.ExecuteNonQuery();

    load1();

    load();

    }

    private void Form3_Load(object sender, EventArgs e) {

    load();

    load1();

    }

    protected void load()

    {

    conn = new SqlConnection(connstring);

    conn.Open();

    string sql_select = "SELECT DISTINCT [PRESS] FROM [BOOK] ORDER BY [PRESS]";

    cmd = new SqlCommand(sql_select, conn);

    SqlDataReader dr = cmd.ExecuteReader();

    chubanshe.Items.Clear();

    while (dr.Read())

    chubanshe.Items.Add(dr[0]);

    dr.Close();

    cmd.CommandText = "SELECT DISTINCT [Barcode] FROM [Book] ORDER BY [Barcode]";

    SqlDataReader ds = cmd.ExecuteReader();

    tushutiaoma.Items.Clear();

    while (ds.Read())

    tushutiaoma.Items.Add(ds[0]);

    ds.Close();

    cmd.CommandText = "SELECT DISTINCT [ISBN] FROM [Book] ORDER BY [ISBN]";

    SqlDataReader st = cmd.ExecuteReader();

    comboBox1.Items.Clear();

    while (st.Read())

    comboBox1.Items.Add(st[0]);

    st.Close();

    }

    protected void load1()

    {

    string sql = "select *from book";

    conn = new SqlConnection(connstring);

    conn.Open();

    SqlDataAdapter da = http://www.xielw.cn/qingkuangbaogao/ 情況報告new SqlDataAdapter(sql, conn); DataSet ds = new DataSet();

    da.Fill(ds, "book");

    dataGridView1.DataSource = ds.Tables["book"];

    }

    private DataTable BindData(string sql)

    {

    string sql_select = sql;

    conn = new SqlConnection(connstring);

    SqlDataAdapter ad = new SqlDataAdapter(sql_select, conn); DataSet ds = new DataSet();

    ad.Fill(ds, "Book");

    return ds.Tables["Book"];

    }

    private void all_Click(object sender, EventArgs e)

    {

    string sql = "select *from book";

    conn = new SqlConnection(connstring);

    conn.Open();

    SqlDataAdapter da = new SqlDataAdapter(sql, conn);

    DataSet ds = new DataSet();

    da.Fill(ds, "book");

    dataGridView1.DataSource = ds.Tables["book"]; }

    }

    }

    五.借書模塊

    代碼如下:

    using System;

    using System.Collections.Generic;

    using System.ComponentModel;

    using System.Data;

    using System.Data.SqlClient;

    using System.Drawing;

    using System.Text;

    using System.Windows.Forms;

    namespace WindowsApplication1

    {

    public partial class Form4 : Form

    {

    protected SqlConnection conn;

    protected SqlCommand cmd;

    string connstring = @"Data Source=panlunzhao;Initial Catalog=BOOKSTORE.MDhttp://www.xielw.cn/banjigongzuojihua/ 班級工作計劃 F;Integrated Security=True";

    public Form4()

    {

    InitializeComponent();

    }

    private void Form4_Load(object sender, EventArgs e)

    {

    try

    {

    conn = new SqlConnection(@"Data

    Source=panlunzhao;Initial Catalog=BOOKSTORE.MDF;Integrated

    Security=True");

    conn.Open();

    this.InitData();

    }

    catch (Exception exp)

    {

    MessageBox.Show("無法建立數據連接:" + exp.Message); this.Close();

    }

    }

    protected void InitData()

    {

    cmd = new SqlCommand("select distinct [ID] from Book order By [ID]", conn);

    SqlDataReader reader1 = cmd.ExecuteReader();

    comboBox1.Items.Clear();

    while (reader1.Read())

    comboBox1.Items.Add(reader1[0]);

    reader1.Close();

    cmd = new SqlCommand("select id from reader order by[ID]",conn);

    SqlDataReader reader2 = cmd.ExecuteReader();

    id.Items.Clear();

    while (reader2.Read())

    id.Items.Add(reader2[0]);

    reader2.Close();

    }

    private void select_Click(object sender, EventArgs e) http://www.xielw.cn/chengxinyanjianggao/ 誠信演講稿 {

    string sql = "select * from book where ID='" +

    comboBox1.Text.ToString() + "'";

    conn = new SqlConnection(connstring);

    conn.Open();

    SqlCommand cmd = new SqlCommand(sql, conn);

    SqlDataReader ds = cmd.ExecuteReader();

    ds.Read();

    textBox1.Text = ds["ISBN"].ToString();

    textBox2.Text = ds["name"].ToString();

    textBox3.Text = ds["author"].ToString();

    textBox4.Text = ds["press"].ToString();

    textBox5.Text = ds["publishdate"].ToString();

    textBox6.Text = ds["price"].ToString();

    textBox7.Text = ds["pages"].ToString();

    textBox8.Text = ds["barcode"].ToString();

    radioButton1.Checked = (bool)ds["cd"];

    textBox10.Text = ds["storage"].ToString();

    }

    private void jieshu_Click(object sender, EventArgs e) {

    string sql = "select * from reader where ID='" + id.Text.ToString() + "'";

    conn = new SqlConnection(connstring);

    conn.Open();

    SqlDataAdapter da = new SqlDataAdapter(sql, conn); DataSet ds = new DataSet();

    da.Fill(ds, "book");

    dataGridView1.DataSource = ds.Tables["book"];

    string sql_up = "book set Storage=Storage-1 where ID='" + comboBox1.Text.ToString() + "'";

    cmd = new SqlCommand(sql_up, conn);

    cmd.ExecuteNonQuery();

    DataSet hs = new DataSet();

    da.Fill(hs, "book");

    dataGridView1.DataSource = hs.Tables["book"];

    if (comboBox1.Text == "")

    return;

    cmd.CommandText = "SELECT * FROM [reader] WHERE [ID]=" + id.Text;

    SqlDataReader reader1 = null;

    try

    {

    reader1 = cmd.ExecuteReader();

    if (reader1.Read())

    {

    textBhttp://www.xielw.cn/gerengongzuojihua/ 個人工作計劃 ox17.Text = reader1["Name"].ToString();

    }

    else

    {

    MessageBox.Show("沒有符合條件的記錄", "提示", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);

    }

    }

    catch (Exception exp)

    {

    MessageBox.Show("數據訪問錯誤:" + exp.Message +

    exp.StackTrace, "錯誤", MessageBoxButtons.OK, MessageBoxIcon.Error); }

    finally

    {

    if (reader1 != null && !reader1.IsClosed)

    reader1.Close();

    }

    }

    }

    }

    總結

    此次實訓綜合考查了所學的c#知識,讓我知道一個項目從構思、設計、實結題報告現、測試的過程。在實訓中也綜合運用了所學的知識,也涵蓋了數據庫的知識,用數據庫存放數據,用腳本實現功能。



    【上機實習報告總結結尾】相關文章:

    計算機上機實習報告09-13

    實習報告結尾01-24

    優秀實習報告結尾02-21

    國際貿易實物機房上機模擬實習總結02-27

    實習報告結尾怎么寫?07-10

    國際貿易實物機房上機模擬實習總結3篇02-27

    述職報告結尾06-01

    工作報告結尾07-04

    述職報告精彩結尾01-11

    述職報告寫作結尾09-30

    黄频国产免费高清视频_富二代精品短视频在线_免费一级无码婬片aa_精品9E精品视频在线观看