1、C#实习报告实习报告实习性质: ASP.net初级开发与应用_ 学生姓名: _ _ _ 专业班级: 计 应 102 指导教师: 实习时间: 2011年6月27日-2011年7月 1日 _实习地点: 第四教学楼4312教室 重庆工程职业技术学院学 生 实 习 考 核 表学生姓名专业班级指 导 教 师 计应 102刘宇、邓荣、郑晓蓉实习时间2011年6月27 日 至 2011年7月1日实习地点第四教学楼4312教室实习名称ASP.net初级开发与应用自我总结(包括遵守纪律、增长知识、动手能力、独立工作、团队协作等方面) 经过这段时间的上机实习,使我明白了上机的重要性,因为上机可以帮助我们更好的理解
2、程序和进一步的了解它的发展在我们这个领域,因为上机,我们的无限潜能才能被开发出来,所以我们要明白实习虽然累、苦,但是我们一定要克服。毕竟克服了才有所收获嘛,而且还能为我们打下扎实的基础。指导教师意见实习单位意见并盖章(院内实习由系签署)考核等级 目录一、实习目的 3二、实习任务 3三、实习内容 3一 : 学习指导1 31:使用条件运算符找到较大数 32.给一个长度为6的整数密码加密 43.模拟用户登录时的密码验证。 54.为商品价格排序 7二: 学习指导2-机票查询及预订功能. 8阶段一:窗体设计及数据库连接。 8阶段二:各窗体间的相关代码。 10阶段三:实现航班机票查询及预订功能先关信息。
3、23四、实习成果 24五、实习心得 24一、实习目的加强对课本相关知识的了解,和控制台程序的开发应用与窗体设计开发环境的熟练掌握及其运用到我们的实际生活当中,因为这样我们对他的兴趣才能进一步的融入进去,再加上一周的实习以至于达到学以致用的效果。二、实习任务 完成课本知识后的相关内容和机票查询及预定系统,并从中进一步学习课程相关的内容,达到学以致用的效果三、实习内容一 : 学习指导11:使用条件运算符找到较大数代码: using System;using System.Collections.Generic;using System.Linq;using System.Text;namespac
4、e ConsoleApplication1 class Program static void Main(string args) int max; Console.WriteLine(-数的大小比较-); Console.Write(请输入第一个数:); int num1 = int.Parse(Console.ReadLine(); Console.Write(请输入第二个数:); int num2 = int.Parse(Console.ReadLine(); if (num1 num2) max = num1; else max = num2; Console.Write(较大的数是:
5、); Console.Write(max); Console.ReadLine(); 结果:2.给一个长度为6的整数密码加密代码: using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace ConsoleApplication2 class Program static void Main(string args) string pwd; / 原始密码 int pwdInt = 0; / 转换为整数后的密码 string encrptedPwd = ; / 加密后的密码
6、 int pwds = new int6; / 存放加密处理后的密码的数组 int temp; / 存放临时数据 int i; / 循环变量 Console.WriteLine(-密码加密-); Console.WriteLine(请输入一个长度为6的整数,作为你的原始密码); do / 接收输入的密码 pwd = Console.ReadLine(); if (pwd.Length != 6) Console.WriteLine(密码长度不正确,请输入一个长度为6位的密码!); while (pwd.Length != 6); pwdInt = int.Parse(pwd); / 将输入的字
7、符串转换为整数 for (i = 0; i 6; i+)/ 将密码拆分为一个数组 pwdsi = pwdInt % 10; pwdInt = pwdInt / 10; for (i = 0; i = 0; i-) / 得到加密后的新密码 encrptedPwd = encrptedPwd + pwdsi; Console.WriteLine(加密后的密码为: + encrptedPwd); Console.ReadLine(); 结果:3.模拟用户登录时的密码验证。代码:using System;using System.Collections.Generic;using System.Lin
8、q;using System.Text;namespace ConsoleApplication3 class Program static void Main(string args) int count = 1; string s = 123456; string d = 111; string a; string b; Console.WriteLine(-请输入用户名和密码进行登陆-); / Console.WriteLine(用户名:123456); /Console.WriteLine(密码:111n); do Console.WriteLine(请输入正确的用户名或密码!); C
9、onsole.Write(用户名:); a = Console.ReadLine(); Console.Write(密码:); b = Console.ReadLine(); if (a = s & b = d) Console.WriteLine(恭喜你!登录成功!); break; else count+; if (count 3) Console.WriteLine(你当前的操作频繁,请稍候再试!); break; while (count = 3); Console.ReadLine(); 结果:4.为商品价格排序代码:using System;using System.Collect
10、ions.Generic;using System.Linq;using System.Text;namespace ConsoleApplication3 class Program static void Main(string args) int scores = new int8; int i, j; int temp; Console.WriteLine(-商品价格排序-); Console.WriteLine(请输入8件商品的价格); for (i = 0; i 8; i+) Console.Write(请输入第0件商品的价格:, i + 1); scoresi = int.Par
11、se(Console.ReadLine(); for (i = 0; i scores.Length - 1; i+) for (j = 0; j scores.Length - 1 - i; j+) if (scoresj scoresj + 1) temp = scoresj; scoresj = scoresj + 1; scoresj + 1 = temp; Console.WriteLine(从高到低排序后的价格为:); for (i = 0; i 0) MessageBox.Show(注册成功); else MessageBox.Show(注册失败); DBHelper.conne
12、ction.Close(); private void button2_Click(object sender, EventArgs e) this.Close(); Form3 d = new Form3(); d.Show(); this.Visible = false; 3::各类信息查询相关代码:using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Data.SqlClient;using System.Drawing;using
13、System.Linq;using System.Text;using System.Windows.Forms;namespace 学习指导2 public partial class Form3 : Form /声明并初始化Dataset private DataSet dataset = new DataSet(); /声明dataAdaptr private SqlDataAdapter dataadspter; public Form3() InitializeComponent(); private void Form3_Load(object sender, EventArgs
14、e) /打开数据库 DBHelper.connection.Open(); /信息表显示 if (dataset.Tables.Count 0) /清空原有数据 dataset.Tablesxinxi.Clear(); /sql查询语句 string sql1 = string.Format(select * from xinxi ); /创建dataadaper对象 dataadspter = new SqlDataAdapter(sql1, DBHelper.connection); dataadspter.Fill(dataset, xinxi); /指定数据源 dataGridView
15、2.DataSource = dataset.Tablesxinxi; string sql2 = string.Format(select 用户名,证件类型,证件号 from imformaion ); /创建dataadaper对象 dataadspter = new SqlDataAdapter(sql2, DBHelper.connection); dataadspter.Fill(dataset, imformaion); /指定数据源 dataGridView1.DataSource = dataset.Tablesimformaion; string sql3 = string.
16、Format(select * from yuding ); /创建dataadaper对象 dataadspter = new SqlDataAdapter(sql3, DBHelper.connection); dataadspter.Fill(dataset, yuding); /指定数据源 dataGridView3.DataSource = dataset.Tablesyuding; /关闭数据库 DBHelper.connection.Close(); private void 注册信息ToolStripMenuItem_Click(object sender, EventArgs
17、 e) Form4 sa = new Form4(); sa.Show(); this.Visible = false; private void 机票预订ToolStripMenuItem_Click(object sender, EventArgs e) Form2 da = new Form2(); da.Show(); this.Visible = false; private void 刷新数据库ToolStripMenuItem_Click(object sender, EventArgs e) string sql3 = string.Format(select 用户名,证件类型
18、,证件号 from imformaion ); DBHelper.connection.Open(); dataset.Tablesimformaion.Clear(); dataadspter.SelectCommand.CommandText = sql3; dataadspter.Fill(dataset, imformaion); DBHelper.connection.Close(); private void 退出ToolStripMenuItem_Click(object sender, EventArgs e) Application.Exit(); private void
19、用户信息ToolStripMenuItem_Click(object sender, EventArgs e) / 获得当前选中的行的id列中的值 string id = Convert.ToString(dataGridView1.SelectedRows0.CellsColumn1.Value); string sql1 = string.Format(delete from imformaion where 用户名 =0, id); SqlCommand command = new SqlCommand(sql1, DBHelper.connection); DBHelper.connection.Open(); int sp = command.ExecuteNonQuery();/执行命令 if (sp 0) MessageBox.Show(删除成功, 提示, MessageBoxButtons.OK, MessageBoxIcon.Information); dataset.Tablesimformaion.Clear(); dataadspter.SelectCommand.CommandText = sql1; dataadspter.Fill(dataset, imformaion); else
copyright@ 2008-2023 冰点文库 网站版权所有
经营许可证编号:鄂ICP备19020893号-2