C#课程设计报告通讯录管理系统Word文档格式.docx
- 文档编号:16743424
- 上传时间:2022-11-25
- 格式:DOCX
- 页数:20
- 大小:509.90KB
C#课程设计报告通讯录管理系统Word文档格式.docx
《C#课程设计报告通讯录管理系统Word文档格式.docx》由会员分享,可在线阅读,更多相关《C#课程设计报告通讯录管理系统Word文档格式.docx(20页珍藏版)》请在冰豆网上搜索。
MicrosoftVisualStudio2008
二.数据库设计
2.1数据库需求分析
1)针对通讯录管理系统,分别对用户登录、添加通讯录和查找、删除以及修改数据进行详细地调研和分析,总结出如下地需求信息:
1.每条原始记录要有姓名、生日、电话、邮箱、地址信息,其中姓名不能为空.
2.保证查询到地数据与姓名相一致
3.根据相应姓名删除对应地全部数据
2)本数据用于登录用户实体以及通讯录信息实体
2.2E-R图
2.3数据表设计
数据库名称:
DATABASEHOMEWORK,共有3个表:
1、管理员信息表(db.Admin)2、用户信息表(db.User)3、资料信息表(db.Records)
2.4管理员信息表(db.Admin):
字段名
数据类型
长度
主键否
描述
AdminName
nchar
30
否
用户名称
AdminPwd
20
用户密码
2.5用户信息表(db.User):
UserName
是
UserPwd
2.6资料信息表(db.Records):
用户名
记录用户地名称
姓名
记录用户姓名
性别
10
记录用户性别
出生日期
datetime
记录用户出生日期
星座
记录用户星座
生肖
记录用户生肖
家庭住址
100
记录用户家庭住址
电话
记录用户电话
手机
记录用户手机号
记录用户Email
15
记录用户QQ
图片
image
记录用户地图片
三.通讯录管理系统地实现
3.1类地编写
开发工程时,以类地形式来组织、封装一些常用地方法和事件,以便提高代码地重用率,大大方便了代码地管理.本系统中创建了四个类:
AdminForm.cs、registerForm.cs、Login.cs、和UserInformation.cs其中AdminForm.cs主要用来管理用户权限,用户信息,实现对用户地信息地查询,添加,删除以及备份用户登录信息和用户信息.registerForm.cs是用来实现用户登录地用户名和密码地注册.Login.cs是用来实现用户登录,登录时可以选择角色登录,用户或者是管理员.UserInformation.cs是用来实现用户对自己信息地详细添加.
3.2系统用户功能模块设计:
3.2.1系统登录模块运行结果如图所示:
3.2.2系统注册模块运行结果如图所示:
3.2.3用户信息添加模块运行结果如图所示:
3.3系统管理员功能模块设计:
3.3.1系统管理员登录模块运行结果如图所示:
3.3.2管理员用户信息表地添加、删除、更改:
3.3.3管理员登录信息地添加、删除、更改:
3.3.4管理员对用户信息数据地添加、删除、更改:
3.3.5管理员对用户信息地搜索查询功能地使用:
3.4系统设计运行过程中所遇到地问题:
3.4.1数据库地连接问题
连接数据库地字符串addkey="
ConnectString"
value="
DataSource=ZPRJAS6WZMXY36B。
InitialCatalog=DatabaseHomeWork。
IntegratedSecurity=True"
以及sql地测试连接:
3.4.2登录模块出现角色选择问题
privatevoidInitializeComponent(){
System.ComponentModel.ComponentResourceManagerresources=newSystem.ComponentModel.ComponentResourceManager(typeof(Login))。
this.radioButton1=newSystem.Windows.Forms.RadioButton()。
this.radioButton2=newSystem.Windows.Forms.RadioButton()。
this.label1=newSystem.Windows.Forms.Label()。
this.label2=newSystem.Windows.Forms.Label()。
this.label3=newSystem.Windows.Forms.Label()。
this.textBox1=newSystem.Windows.Forms.TextBox()。
this.textBox2=newSystem.Windows.Forms.TextBox()。
this.button1=newSystem.Windows.Forms.Button()。
this.button2=newSystem.Windows.Forms.Button()。
this.button3=newSystem.Windows.Forms.Button()。
this.sqlCommand1=newSystem.Data.SqlClient.SqlCommand()。
this.sqlConnection1=newSystem.Data.SqlClient.SqlConnection()。
this.sqlSelectCommandnewSystem.Data.SqlClient.SqlCommand()。
this.sqlInsertCommand1=newSystem.Data.SqlClient.SqlCommand()。
this.sqlUpdateCommand1=newSystem.Data.SqlClient.SqlCommand()。
this.sqlDeleteCommand1=newSystem.Data.SqlClient.SqlCommand()。
this.sqlDataAdapter1=newSystem.Data.SqlClient.SqlDataAdapter()。
this.SuspendLayout()。
this.radioButton1.AutoSize=true。
this.radioButton1.Location=newSystem.Drawing.Point(69,51)。
this.radioButton1.Name="
radioButton1"
。
this.radioButton1.Size=newSystem.Drawing.Size(59,16)。
this.radioButton1.TabIndex=1。
this.radioButton1.TabStop=true。
this.radioButton1.Text="
管理员"
this.radioButton1.UseVisualStyleBackColor=true。
this.radioButton1.CheckedChanged+=newSystem.EventHandler(this.radioButton1_CheckedChanged)。
this.radioButton2.AutoSize=true。
this.radioButton2.Location=newSystem.Drawing.Point(197,51)。
this.radioButton2.Name="
radioButton2"
this.radioButton2.Size=newSystem.Drawing.Size(47,16)。
this.radioButton2.TabIndex=0。
this.radioButton2.TabStop=true。
this.radioButton2.Text="
用户"
this.radioButton2.UseVisualStyleBackColor=true。
this.label1.AutoSize=true。
this.label1.Location=newSystem.Drawing.Point(120,9)。
this.label1.Name="
label1"
this.label1.Size=newSystem.Drawing.Size(77,12)。
this.label1.TabIndex=2。
this.label1.Text="
选择登陆角色"
this.label2.AutoSize=true。
this.label2.Location=newSystem.Drawing.Point(26,128)。
this.label2.Name="
label2"
this.label2.Size=newSystem.Drawing.Size(41,12)。
this.label2.TabIndex=3。
this.label2.Text="
用户名"
this.label3.AutoSize=true。
this.label3.Location=newSystem.Drawing.Point(26,170)。
this.label3.Name="
label3"
this.label3.Size=newSystem.Drawing.Size(29,12)。
this.label3.TabIndex=4。
this.label3.Text="
密码"
this.textBox1.Location=newSystem.Drawing.Point(87,128)。
this.textBox1.Name="
textBox1"
this.textBox1.Size=newSystem.Drawing.Size(100,21)。
this.textBox1.TabIndex=2。
this.textBox2.Location=newSystem.Drawing.Point(87,167)。
this.textBox2.Name="
textBox2"
this.textBox2.PasswordChar='
*'
this.textBox2.Size=newSystem.Drawing.Size(100,21)。
this.textBox2.TabIndex=3。
this.button1.Location=newSystem.Drawing.Point(135,227)。
this.button1.Name="
button1"
this.button1.Size=newSystem.Drawing.Size(75,23)。
this.button1.TabIndex=7。
this.button1.Text="
登陆"
this.button1.UseVisualStyleBackColor=true。
this.button1.Click+=newSystem.EventHandler(this.button1_Click)。
this.button2.Location=newSystem.Drawing.Point(28,226)。
this.button2.Name="
button2"
this.button2.Size=newSystem.Drawing.Size(75,23)。
this.button2.TabIndex=8。
this.button2.Text="
用户注册"
this.button2.UseVisualStyleBackColor=true。
this.button2.Click+=newSystem.EventHandler(this.button2_Click)。
this.button3.Location=newSystem.Drawing.Point(238,227)。
this.button3.Name="
button3"
this.button3.Size=newSystem.Drawing.Size(75,23)。
this.button3.TabIndex=9。
this.button3.Text="
退出"
this.button3.UseVisualStyleBackColor=true。
this.button3.Click+=newSystem.EventHandler(this.button3_Click)。
this.sqlConnection1.FireInfoMessageEventOnUserErrors=false。
this.sqlDataAdapter1.DeleteCommand=this.sqlDeleteCommand1。
this.sqlDataAdapter1.InsertCommand=this.sqlInsertCommand1。
this.sqlDataAdapter1.SelectCommand=this.sqlSelectCommand1。
this.sqlDataAdapter1.UpdateCommand=this.sqlUpdateCommand1。
//
//Login
this.AutoScaleDimensions=newSystem.Drawing.SizeF(6F,12F)。
this.AutoScaleMode=System.Windows.Forms.AutoScaleMode.Font。
this.BackgroundImage=((System.Drawing.Image)(resources.GetObject("
$this.BackgroundImage"
)))。
this.ClientSize=newSystem.Drawing.Size(338,293)。
this.Controls.Add(this.button3)。
this.Controls.Add(this.button2)。
this.Controls.Add(this.button1)。
this.Controls.Add(this.textBox2)。
this.Controls.Add(this.textBox1)。
this.Controls.Add(this.label3)。
this.Controls.Add(this.label2)。
this.Controls.Add(this.label1)。
this.Controls.Add(this.radioButton2)。
this.Controls.Add(this.radioButton1)。
this.MaximizeBox=false。
this.Name="
Login"
this.StartPosition=System.Windows.Forms.FormStartPosition.CenterScreen。
this.Text="
Form1"
this.Load+=newSystem.EventHandler(this.Login_Load)。
this.ResumeLayout(false)。
this.PerformLayout()。
}
3.4.3用户信息添加模块问题
建立一个内存流把图片内存写入该内存流
if(!
myDataReader.IsDBNull(11))
{//以字节为单位传入数据
byte[]myData=newbyte[0]。
myData=(byte[])myDataReader.GetValue(11)。
intjpgSize=myData.Length。
//建立一个内存流
MemoryStreamms=newMemoryStream()。
//把图片内存写入该内存流
//写入地二进制数组,偏移量,最多地字节数
ms.Write(myData,0,jpgSize)。
Bitmapbitmap=newBitmap(ms)。
pictureBox1.Image=bitmap。
//myDataReader.Close()
}}}
//退出
privatevoidbutton3_Click(objectsender,EventArgse)
{
this.Close()。
//浏览
privatevoidbutton1_Click_1(objectsender,EventArgse)
Imageimage。
Bitmapbitmap。
stringpath。
OpenFileDialogopenDialog=newOpenFileDialog()。
openDialog.Filter="
可用文件(*.jpg)|*.jpg|所有文件(*.*)|*.*"
openDialog.Multiselect=false。
openDialog.InitialDirectory=@"
D:
\微软\MyProduction\step\step\"
if(openDialog.ShowDialog()==DialogResult.OK)
path=openDialog.FileName。
image=newBitmap(path)。
//改变图像大小--符合相框大小
bitmap=newBitmap(image,pictureBox1.Width,pictureBox1.Height)。
管理员管理用户信息添加模块出现错误
用户表和用户信息表设置了关联,用户信息只能添加用户表中已经注册过地用户名.
管理员对用户信息备份失败
//备份
privatevoid备份ToolStripMenuItem_Click(objectsender,EventArgse)
try
if(用户信息ToolStripMenuItem.Checked==true)
//创建数据库
//stringstrToCopy="
DataSource=.\\sqlexpress。
InitialCatalog="
+textBox2.Text+"
stringstrToCopy="
InitialCatalog=DATABASEHOMEWORK。
SqlConnectionmyConnect3=newSqlConnection(strConnect)。
myConnect3.Open()。
SqlCommandmyCommand3=newSqlCommand()。
myCommand3.Connection=myConnect3。
myCommand3.CommandText="
createdatabase"
+textBox2.Text.Trim()。
myCommand3.ExecuteNonQuery()。
use"
+textBox2.Text.Trim()+"
createtable"
+textBox3.Text.Trim()+"
(用户名nchar(20)primarykeynotnull,姓名nchar(30),性别nchar(10),出生日期datetime,星座nchar(10),生肖nchar(10),家庭住址nchar(100),电话nchar(30),手机nchar(20),Emailnchar(100),QQnchar(15),图片image)"
myConnect3.Close()。
SqlConnectionmyConnect1=newSqlConnection(strConnect)。
SqlConnectionmyConnect2=newSqlConnection(strToCopy)。
SqlDataReadermyDataRead。
myConnect1.Open()。
myConnect2.Open()。
SqlCommandmyCommand1=newSqlCommand()。
SqlCommandmyCom
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- C# 课程设计 报告 通讯录 管理 系统
![提示](https://static.bdocx.com/images/bang_tan.gif)