您好,欢迎访问三七文档
当前位置:首页 > 建筑/环境 > 给排水/暖通与智能化 > C#整周实习报告
C#实习报告班级:10计算机应用技术姓名:学号;专业:计算机应用指导教师:赵中营实习题目:制作一个简单的通讯录管理系统一、实习目的这学期通过对C#可视化程序的学习,掌握了解了可视化程序的简单编写和C#程序的应用,C#是一种面向对象的程序编辑,通过这次实习让我们在实践中理解运用C#编程,基础上进一步熟悉了visualstudio2005,为以后的学习和工作打下了良好的基础。同时也增强我们编程的能力。二、实习要求要完成这个题目首先要做好数据库的设计要满足要求,了解VisualStudio2005的基本使用方法,基本属性以及使用VC2005编写C#程序的基本规范;了解使用VC2005编写、调试程序的基本步骤与方法,能够通过调试发现并修改程序的一般错误。三、功能模块的结构1、系统登录模块2、系统功能模块3、通讯录信息的查询模块4、通讯录信息的修改模块5、通讯录信息的添加模块6、通讯录信息的删除模块四、实习成果程序设计1.系统登陆模块程序代码privatevoidbutton1_Click(objectsender,EventArgse){if(textBox1.Text==){MessageBox.Show(用户名不能为空!);}if(textBox2.Text==){MessageBox.Show(请输入密码!);}OleDbConnectioncon=newOleDbConnection(Provider=Microsoft.Jet.OLEDB.4.0;DataSource=201005010112.mdb);con.Open();stringSql=SELECT*FROM蒋英杰WHERE姓名='+textBox1.Text.Trim()+'and密码='+textBox2.Text.Trim()+'orderby学号;OleDbCommandcmd=newOleDbCommand(Sql,con);OleDbDataReadermyReader=cmd.ExecuteReader();if(myReader.Read()){Form2frm=newForm2();frm.ShowDialog();}else{MessageBox.Show(你的密码或用户名出错!请重新输入!);return;}con.Close();2.系统功能模块程序代码publicpartialclassForm2:Form{publicForm2(){InitializeComponent();}privatevoidbutton1_Click(objectsender,EventArgse){Form3frm=newForm3();frm.Show();}privatevoidbutton2_Click(objectsender,EventArgse){Form4frm=newForm4();frm.Show();}privatevoidbutton3_Click(objectsender,EventArgse){Form5frm=newForm5();frm.Show();}privatevoidbutton4_Click(objectsender,EventArgse){Form6frm=newForm6();frm.Show();}3.信息查询模块程序代码publicpartialclassForm3:Form{publicForm3(){InitializeComponent();}privatevoidbutton1_Click(objectsender,EventArgse){OleDbConnectioncon=newOleDbConnection(Provider=Microsoft.Jet.OLEDB.4.0;DataSource=201005010112.mdb);;con.Open();OleDbDataAdaptermyAdapter;stringSql=Select*From蒋英杰where姓名='+textBox1.Text.Trim()+'OrderBy姓名;myAdapter=newOleDbDataAdapter(Sql,con);DataSetmyDataSet=newDataSet();myAdapter.Fill(myDataSet,201005010112);dataGridView1.DataSource=myDataSet.Tables[201005010112];}4.信息修改模块程序代码privatevoidbutton2_Click_1(objectsender,EventArgse){OleDbConnectioncon=newOleDbConnection(Provider=Microsoft.Jet.OLEDB.4.0;DataSource=201005010112.mdb);con.Open();OleDbDataAdaptermyAdapter;stringSq1=Select*From蒋英杰Where姓名='+textBox1.Text.Trim()+'OrderBy姓名;myAdapter=newOleDbDataAdapter(Sq1,con);DataSetmyDataSet=newDataSet();myAdapter.Fill(myDataSet,201005010112);dataGridView1.DataSource=myDataSet.Tables[201005010112];con.Close();textBox2.Text=Convert.ToString(dataGridView1.Rows[0].Cells[2].Value);textBox3.Text=Convert.ToString(dataGridView1.Rows[0].Cells[1].Value);textBox4.Text=Convert.ToString(dataGridView1.Rows[0].Cells[8].Value);textBox5.Text=Convert.ToString(dataGridView1.Rows[0].Cells[4].Value);textBox6.Text=Convert.ToString(dataGridView1.Rows[0].Cells[5].Value);textBox7.Text=Convert.ToString(dataGridView1.Rows[0].Cells[7].Value);textBox8.Text=Convert.ToString(dataGridView1.Rows[0].Cells[9].Value);}privatevoidbutton1_Click_1(objectsender,EventArgse){try{OleDbConnectioncon=newOleDbConnection(Provider=Microsoft.Jet.OLEDB.4.0;DataSource=201005010112.mdb);con.Open();stringSql=update蒋英杰Set学号='+textBox2.Text+',学号='+textBox2.Text+',性别='+comboBox1.SelectedItem.ToString()+',身份证号='+textBox4.Text+',手机号码='+textBox5.Text+',家庭住址='+textBox6.Text+',QQ号='+textBox7.Text+',密码='+textBox8.Text+'+Where姓名='+textBox1.Text.Trim()+';OleDbCommandcmd=newOleDbCommand(Sql,con);cmd.ExecuteNonQuery();con.Close();MessageBox.Show(修改成功!,提示);}catch{MessageBox.Show(修改失败!请重新修改。,提示);return;}5.信息添加模块程序代码privatevoidbutton1_Click_2(objectsender,EventArgse){try{OleDbConnectioncon=newOleDbConnection(Provider=Microsoft.Jet.OLEDB.4.0;DataSource=201005010112.mdb);con.Open();stringSql=InsertInto蒋英杰(姓名,学号,性别,手机号码,QQ号,家庭住址,权限,密码)Values('+textBox1.Text.Trim()+','+textBox2.Text.Trim()+','+comboBox1.SelectedItem.ToString()+','+textBox4.Text.Trim()+','+textBox5.Text.Trim()+','+textBox6.Text.Trim()+','+textBox7.Text.Trim()+','+comboBox2.SelectedItem.ToString()+');OleDbCommandcmd=newOleDbCommand(Sql,con);cmd.ExecuteNonQuery();con.Close();MessageBox.Show(添加信息成功!,提示);}catch{MessageBox.Show(添加信息失败!,提示);}}privatevoidbutton2_Click_1(objectsender,EventArgse){textBox1.Text=;textBox2.Text=;comboBox1.Text=;textBox4.Text=;textBox5.Text=;textBox6.Text=;comboBox2.Text=;textBox7.Text=;}6.信息删除模块程序代码privatevoidbutton1_Click(objectsender,EventArgse){OleDbConnectioncon=newOleDbConnection(Provider=Microsoft.Jet.OLEDB.4.0;DataSource=201005010112.mdb);con.Open();OleDbDataAdaptermyAdapter;stringSq1=Select*From蒋英杰Where姓名='+textBox1.Text.Trim()+'OrderBy姓名;myAdapter=newOleDbDataAdapter(Sq1,con);DataSetmyDataSet=newDataSet();myAdapter.Fill(myDataSet,201005010112);dataGridView1.DataSource=myDataSet.Tables[201005010112];con.Close();}privatevoidbutton2_Click(objectsender,EventArgse){try{OleDbConnectioncon=newOleDbConnection(Provider=Microsoft.Jet.OLEDB.4.0;DataSource=201005010112.mdb);con.Open();stringSql=DeleteFrom蒋英杰Where姓名='+textBox1.Text.Replace(','')+';OleDbCommandcmd=newOleDbCommand(Sql,con);cmd.ExecuteNonQuery();con.Close();MessageBox.Show(删除成功!,提示);}catch{MessageBox.Show(删除失败!,提示);return;}五、实习总结通过这个星期的实习,我和宿舍几个同学也做了一些讨论,visual
本文标题:C#整周实习报告
链接地址:https://www.777doc.com/doc-4674129 .html