上机实习报告总结结尾

时间: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.pincai.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