C#实习报告.docx

上传人:b****8 文档编号:10103998 上传时间:2023-05-23 格式:DOCX 页数:34 大小:441.17KB
下载 相关 举报
C#实习报告.docx_第1页
第1页 / 共34页
C#实习报告.docx_第2页
第2页 / 共34页
C#实习报告.docx_第3页
第3页 / 共34页
C#实习报告.docx_第4页
第4页 / 共34页
C#实习报告.docx_第5页
第5页 / 共34页
C#实习报告.docx_第6页
第6页 / 共34页
C#实习报告.docx_第7页
第7页 / 共34页
C#实习报告.docx_第8页
第8页 / 共34页
C#实习报告.docx_第9页
第9页 / 共34页
C#实习报告.docx_第10页
第10页 / 共34页
C#实习报告.docx_第11页
第11页 / 共34页
C#实习报告.docx_第12页
第12页 / 共34页
C#实习报告.docx_第13页
第13页 / 共34页
C#实习报告.docx_第14页
第14页 / 共34页
C#实习报告.docx_第15页
第15页 / 共34页
C#实习报告.docx_第16页
第16页 / 共34页
C#实习报告.docx_第17页
第17页 / 共34页
C#实习报告.docx_第18页
第18页 / 共34页
C#实习报告.docx_第19页
第19页 / 共34页
C#实习报告.docx_第20页
第20页 / 共34页
亲,该文档总共34页,到这儿已超出免费预览范围,如果喜欢就下载吧!
下载资源
资源描述

C#实习报告.docx

《C#实习报告.docx》由会员分享,可在线阅读,更多相关《C#实习报告.docx(34页珍藏版)》请在冰点文库上搜索。

C#实习报告.docx

C#实习报告

实习报告

 

实习性质:

ASP.net初级开发与应用____

学生姓名:

_______________

专业班级:

计应102

指导教师:

实习时间:

2011年6月27日-2011年7月1日_

实习地点:

第四教学楼4312教室

重庆工程职业技术学院

学生实习考核表

学生姓名

专业班级

指导教师

计应102

刘宇、邓荣、郑晓蓉

实习时间

2011年6月27日至2011年7月1日

实习地点

第四教学楼4312教室

实习名称

ASP.net初级开发与应用

自我总结

(包括遵守纪律、增长知识、动手能力、独立工作、团队协作等方面)

经过这段时间的上机实习,使我明白了上机的重要性,因为上机可以帮助我们更好的理解程序和进一步的了解它的发展在我们这个领域,因为上机,我们的无限潜能才能被开发出来,所以我们要明白实习虽然累、苦,但是我们一定要克服。

毕竟克服了才有所收获嘛,而且还能为我们打下扎实的基础。

 

指导教师

意见

实习单位

意见并盖章

(院内实习由系签署)

考核等级

目录

一、实习目的3

二、实习任务3

三、实习内容3

一:

学习指导13

1:

使用条件运算符找到较大数3

2.给一个长度为6的整数密码加密4

3.模拟用户登录时的密码验证。

5

4.为商品价格排序7

二:

学习指导2-机票查询及预订功能.8

阶段一:

窗体设计及数据库连接。

8

阶段二:

各窗体间的相关代码。

10

阶段三:

实现航班机票查询及预订功能先关信息。

23

四、实习成果24

五、实习心得24

一、实习目的

加强对课本相关知识的了解,和控制台程序的开发应用与窗体设计开发环境的熟练掌握及其运用到我们的实际生活当中,因为这样我们对他的兴趣才能进一步的融入进去,再加上一周的实习以至于达到学以致用的效果。

二、实习任务

完成课本知识后的相关内容和机票查询及预定系统,并从中进一步学习课程相关的内容,达到学以致用的效果

三、实习内容

一:

学习指导1

1:

使用条件运算符找到较大数

代码:

usingSystem;

usingSystem.Collections.Generic;

usingSystem.Linq;

usingSystem.Text;

namespaceConsoleApplication1

{

classProgram

{

staticvoidMain(string[]args)

{

intmax;

Console.WriteLine("--数的大小比较--");

Console.Write("请输入第一个数:

");

intnum1=int.Parse(Console.ReadLine());

Console.Write("请输入第二个数:

");

intnum2=int.Parse(Console.ReadLine());

if(num1>num2)

{

max=num1;

}

else

{

max=num2;

}

Console.Write("较大的数是:

");

Console.Write(max);

Console.ReadLine();

}

}

}

结果:

2.给一个长度为6的整数密码加密

代码:

usingSystem;

usingSystem.Collections.Generic;

usingSystem.Linq;

usingSystem.Text;

namespaceConsoleApplication2

{

classProgram

{

staticvoidMain(string[]args)

{

stringpwd;//原始密码

intpwdInt=0;//转换为整数后的密码

stringencrptedPwd="";//加密后的密码

int[]pwds=newint[6];//存放加密处理后的密码的数组

inttemp;//存放临时数据

inti;//循环变量

Console.WriteLine("--密码加密--");

Console.WriteLine("请输入一个长度为6的整数,作为你的原始密码");

do//接收输入的密码

{

pwd=Console.ReadLine();

if(pwd.Length!

=6)

{

Console.WriteLine("密码长度不正确,请输入一个长度为6位的密码!

");

}

}while(pwd.Length!

=6);

pwdInt=int.Parse(pwd);//将输入的字符串转换为整数

for(i=0;i<6;i++)//将密码拆分为一个数组

{

pwds[i]=pwdInt%10;

pwdInt=pwdInt/10;

}

for(i=0;i<6;i++)//加密

{

pwds[i]+=5;

pwds[i]=pwds[i]%10;

}

temp=pwds[0];//将第一位和最后一位交换

pwds[0]=pwds[5];

pwds[5]=temp;

for(i=5;i>=0;i--)//得到加密后的新密码

{

encrptedPwd=encrptedPwd+pwds[i];

}

Console.WriteLine("加密后的密码为:

"+encrptedPwd);

Console.ReadLine();

}

}

}

结果:

3.模拟用户登录时的密码验证。

代码:

usingSystem;

usingSystem.Collections.Generic;

usingSystem.Linq;

usingSystem.Text;

namespaceConsoleApplication3

{

classProgram

{

staticvoidMain(string[]args)

{

intcount=1;

strings="123456";

stringd="111";

stringa;

stringb;

Console.WriteLine("--请输入用户名和密码进行登陆--");

//Console.WriteLine("用户名:

123456");

//Console.WriteLine("密码:

111\n");

do

{

Console.WriteLine("请输入正确的用户名或密码!

");

Console.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.为商品价格排序

代码:

usingSystem;

usingSystem.Collections.Generic;

usingSystem.Linq;

usingSystem.Text;

namespaceConsoleApplication3

{

classProgram

{

staticvoidMain(string[]args)

{

int[]scores=newint[8];

inti,j;

inttemp;

Console.WriteLine("--商品价格排序--");

Console.WriteLine("请输入8件商品的价格");

for(i=0;i<8;i++)

{

Console.Write("请输入第{0}件商品的价格:

",i+1);

scores[i]=int.Parse(Console.ReadLine());

}

for(i=0;i

{

for(j=0;j

{

if(scores[j]

{

temp=scores[j];

scores[j]=scores[j+1];

scores[j+1]=temp;

}

}

}

Console.WriteLine("从高到低排序后的价格为:

");

for(i=0;i

{

Console.Write("{0}\t",scores[i]);

}

Console.WriteLine();

Console.ReadLine();

}

}

}

结果:

二:

学习指导2-机票查询及预订功能.

阶段一:

窗体设计及数据库连接。

1:

用户登录界面。

2:

查询用户、航班、定票信息

3:

机票查询及预订。

4:

用户注册。

5:

所需的数据库。

1:

用户注册信息。

2:

航班信息。

3预订信息。

阶段二:

各窗体间的相关代码。

1:

用户登录窗体:

usingSystem;

usingSystem.Collections.Generic;

usingSystem.ComponentModel;

usingSystem.Data;

usingSystem.Data.SqlClient;

usingSystem.Drawing;

usingSystem.Linq;

usingSystem.Text;

usingSystem.Windows.Forms;

namespace学习指导2

{

publicpartialclassForm2:

Form

{

publicForm2()

{

InitializeComponent();

}

privatevoidForm2_Load(objectsender,EventArgse)

{

stringsa="生分证";

comboBox1.Text=sa.ToString();

}

privatevoidbutton1_Click(objectsender,EventArgse)

{

if(textBox1.Text=="")

{

MessageBox.Show("请输入用户名","提示");

}

elseif(comboBox1.Text=="")

{

MessageBox.Show("请选择证件类型","提示");

}

elseif(textBox2.Text=="")

{

MessageBox.Show("请输入证件号码","提示");

}

elseif(textBox3.Text=="")

{

MessageBox.Show("请输入密码","提示");

}

else

{

stringst="select用户名,证件类型,证件号,用户密码fromimformaionwhere用户名='"+textBox1.Text+"'and证件类型='"+comboBox1.Text+"'and证件号='"+textBox2.Text+"'and用户密码='"+textBox3.Text+"'";

DBHelper.connection.Open();

SqlCommandcommand=newSqlCommand(st,DBHelper.connection);

SqlDataReaderre=command.ExecuteReader();

if(re.Read())

{

DBHelper.connection.Close();

form1ra=newform1();

ra.Show();

this.Visible=false;

}

else

{

MessageBox.Show("错误信息,纠正后在输入");

}

DBHelper.connection.Close();

}

}

privatevoidlinkLabel1_LinkClicked(objectsender,LinkLabelLinkClickedEventArgse)

{

Form3sc=newForm3();

sc.Show();

this.Visible=false;

}

privatevoidbutton2_Click(objectsender,EventArgse)

{

Application.Exit();

}

}

}

2:

用户登记相关代码:

usingSystem;

usingSystem.Collections.Generic;

usingSystem.ComponentModel;

usingSystem.Data;

usingSystem.Data.SqlClient;

usingSystem.Drawing;

usingSystem.Linq;

usingSystem.Text;

usingSystem.Windows.Forms;

namespace学习指导2

{

publicpartialclassForm4:

Form

{

publicForm4()

{

InitializeComponent();

}

privatevoidForm4_Load(objectsender,EventArgse)

{

comboBox1.Text="生分证";

}

privatevoidbutton1_Click(objectsender,EventArgse)

{

string用户名=textBox1.Text;

string证件类型=comboBox1.Text;

string证件号=textBox2.Text;

string密码=textBox3.Text;

stringx=string.Format("insertintoimformaion(用户名,证件类型,证件号,用户密码)values('{0}','{1}','{2}','{3}')",用户名,证件类型,证件号,密码);

//创建command对象

SqlCommandcommand=newSqlCommand(x,DBHelper.connection);

DBHelper.connection.Open();

//调用ExecuteNonQuery函数

intrest=command.ExecuteNonQuery();

if(rest>0)

{

MessageBox.Show("注册成功");

}

else

{

MessageBox.Show("注册失败");

}

DBHelper.connection.Close();

}

privatevoidbutton2_Click(objectsender,EventArgse)

{

this.Close();

Form3d=newForm3();

d.Show();

this.Visible=false;

}

}

}

3:

各类信息查询相关代码:

usingSystem;

usingSystem.Collections.Generic;

usingSystem.ComponentModel;

usingSystem.Data;

usingSystem.Data.SqlClient;

usingSystem.Drawing;

usingSystem.Linq;

usingSystem.Text;

usingSystem.Windows.Forms;

namespace学习指导2

{

publicpartialclassForm3:

Form

{

//声明并初始化Dataset

privateDataSetdataset=newDataSet();

//声明dataAdaptr

privateSqlDataAdapterdataadspter;

publicForm3()

{

InitializeComponent();

}

privatevoidForm3_Load(objectsender,EventArgse)

{//打开数据库

DBHelper.connection.Open();

//信息表显示

if(dataset.Tables.Count>0)

{//清空原有数据

dataset.Tables["xinxi"].Clear();

}

//sql查询语句

stringsql1=string.Format("select*fromxinxi");

//创建dataadaper对象

dataadspter=newSqlDataAdapter(sql1,DBHelper.connection);

dataadspter.Fill(dataset,"xinxi");

//指定数据源

dataGridView2.DataSource=dataset.Tables["xinxi"];

stringsql2=string.Format("select用户名,证件类型,证件号fromimformaion");

//创建dataadaper对象

dataadspter=newSqlDataAdapter(sql2,DBHelper.connection);

dataadspter.Fill(dataset,"imformaion");

//指定数据源

dataGridView1.DataSource=dataset.Tables["imformaion"];

stringsql3=string.Format("select*fromyuding");

//创建dataadaper对象

dataadspter=newSqlDataAdapter(sql3,DBHelper.connection);

dataadspter.Fill(dataset,"yuding");

//指定数据源

dataGridView3.DataSource=dataset.Tables["yuding"];

//关闭数据库

DBHelper.connection.Close();

}

privatevoid注册信息ToolStripMenuItem_Click(objectsender,EventArgse)

{

Form4sa=newForm4();

sa.Show();

this.Visible=false;

}

privatevoid机票预订ToolStripMenuItem_Click(objectsender,EventArgse)

{

Form2da=newForm2();

da.Show();

this.Visible=false;

}

privatevoid刷新数据库ToolStripMenuItem_Click(objectsender,EventArgse)

{

stringsql3=string.Format("select用户名,证件类型,证件号fromimformaion");

DBHelper.connection.Open();

dataset.Tables["imformaion"].Clear();

dataadspter.SelectCommand.CommandText=sql3;

dataadspter.Fill(dataset,"imformaion");

DBHelper.connection.Close();

}

privatevoid退出ToolStripMenuItem_Click(objectsender,EventArgse)

{

Application.Exit();

}

privatevoid用户信息ToolStripMenuItem_Click(objectsender,EventArgse)

{

//获得当前选中的行的id列中的值

stringid=Convert.ToString(dataGridView1.SelectedRows[0].Cells["Column1"].Value);

stringsql1=string.Format("deletefromimformaionwhere用户名='{0}'",id);

SqlCommandcommand=newSqlCommand(sql1,DBHelper.connection);

DBHelper.connection.Open();

intsp=command.ExecuteNonQuery();//执行命令

if(sp>0)

{

MessageBox.Show("删除成功","提示",MessageBoxButtons.OK,MessageBoxIcon.Information);

dataset.Tables["imformaion"].Clear();

dataadspter.SelectCommand.CommandText=sql1;

dataadspter.Fill(dataset,"imformaion");

}

else

{

展开阅读全文
相关资源
猜你喜欢
相关搜索
资源标签

当前位置:首页 > 农林牧渔 > 林学

copyright@ 2008-2023 冰点文库 网站版权所有

经营许可证编号:鄂ICP备19020893号-2