图书馆管理系统设计附带源代码_第1页
图书馆管理系统设计附带源代码_第2页
图书馆管理系统设计附带源代码_第3页
图书馆管理系统设计附带源代码_第4页
图书馆管理系统设计附带源代码_第5页
已阅读5页,还剩84页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

毕业设计_图书管理系统一、数据库设计数据库设CREATE DATABASE TSGLGOUSE TSGLGOCREATE TABLE Bmanage(bIdvarchar(10) PRIMARY KEY,bName varchar(50),

--添加图书--图书编号--书名bNumber

varchar(10),

--书数目)GO

bSore varchar(50)

--分类CREATE TABLE Madmin(mName varchar(10)PRIMARY KEY,mPwd varchar(25),mAge varchar(8),mSex varchar(4),mNumber varchar(15),mrole varchar(8))GO

--图书员管理--图书管理员姓名--图书管理员密码--图书管理员年龄--图书管理员性别--图书管理员--图书管理员角色CREATE TABLE Reader(rSno varchar(10) PRIMARY KEY,rName varchar(10),rPwd varchar(25),rAge varchar(8),rSex varchar(4),rState varchar(8),rNumber varchar(15),rEmail varchar(25),

--读者信息表reader--读者号--姓名--密码--年龄--性别--状态--号码--电子邮件rAdress

varChar(50),

--地址)GO

rGrade varChar(15),rClass varchar(15),rRole varchar(8)

--年级--班级--角色CREATE TABLE Rrecord(rSno varchar(10) PRIMARY KEY,rName varChar(10),bIdvarchar(10),bName varChar(50),bTime varchar(10),bBackTime varchar(10))GOCREATE TABLE SysSet(rRole varchar(8)PRIMARY KEY,rState varchar(8),Fine float(25),rDay varchar(8)

--读者编号学号--读者姓名--图书编号--图书名称--借书时间--还书时间--读者角色--读者可借书数--过期罚款设置--可借书天数)二、界面截图及阐明1) 登录窗口(实现管理员和馆长旳登陆)2) 管理员窗口3) 馆长窗口4) 有关窗口5) 新增图书窗口6) 新增管理员、查找及修改窗口7) 新增读者、查找及修改窗口8) 图书旳查找及修改窗口9) 借阅窗口10)系统设置窗口三、重要代码重要代1) 登录窗口(实现管理员和馆长旳登陆)登陆检查:usingSystem;usingSystem.Collections.Generic;usingSystem.Linq;usingSystem.Text;usingSystem.Data;usingprjTSGL.ClassLib.DBAccess;namespaceprjTSGL.ClassLib.Logic{class clsLoginCheck{public static DataTableCheckLogin(stringUserId,stringPWD){{stringSQLstmt="selectmName,mPwd,mRolefromMadminwheremName='"+UserId+"'andmPwd='"+PWD+"'";DataTabledt=clsGlobalVar.GetDataTable(SQLstmt);returndt;}}}}登陆:usingSystem;usingSystem.Collections.Generic;usingSystem.ComponentModel;usingSystem.Data;usingSystem.Drawing;usingSystem.Linq;usingSystem.Text;usingSystem.Windows.Forms;usingprjTSGL.ClassLib.Logic;namespaceprjTSGL.TSGL_UI{public partial class frmLogin:Form{publicfrmLogin(){InitializeComponent();}private voidbtnLogin_Click(objectsender,EventArgse){stringstrUserID=loginid.Text.Trim();stringstrPWD=loginpwd.Text.Trim();stringtype="";try{DataTabledt=clsLoginCheck.CheckLogin(strUserID,strPWD);if(dt.Rows.Count==0){MessageBox.Show("登陆失败,请重新输入!");loginpwd.Focus();return;}else{type=dt.Rows[0]["mRole"].ToString().Trim();if(cboLT.Text.Trim()=="馆长"){if(type=="馆长"){this.Hide();frmManagerobjManager=new frmManager();objManager.Show();}else{MessageBox.Show("您没有权限!");loginpwd.Focus();return;}}else{if(type=="管理员"){this.Hide();frmAdminobjAdmin=new frmAdmin();objAdmin.Show();}else{MessageBox.Show("您没有权限!");loginpwd.Focus();return;}}}}catch(Exceptionex){throwex;}}private voidbtnExit_Click(objectsender,EventArgse){this.Close();}}}2) 管理员窗口usingSystem;usingSystem.Collections.Generic;usingSystem.ComponentModel;usingSystem.Data;usingSystem.Drawing;usingSystem.Linq;usingSystem.Text;usingSystem.Windows.Forms;namespaceprjTSGL.TSGL_UI{public partial class frmAdmin:Form{publicfrmAdmin(){InitializeComponent();}private voidShowForm(FormfrmToShow){this.Cursor=Cursors.WaitCursor;foreach(FormfrmChildin this.MdiChildren){if(frmChild.GetType()==frmToShow.GetType()){frmToShow.Dispose();frmChild.Activate();this.Cursor=Cursors.Default;return;}}frmToShow.MdiParent=this;frmToShow.Show();this.Cursor=Cursors.Default;}private void读者信息修改ToolStripMenuItem_Click(objectsender,EventArgse){ShowForm(new frmUpdateReader());}private void新增图书ToolStripMenuItem_Click(objectsender,EventArgse){ShowForm(new frmAddNewBook());}private void图书旳查找和修改ToolStripMenuItem_Click(objectsender,EventArgse){ShowForm(new frmUpdateBook());}private void流通管理ToolStripMenuItem_Click(objectsender,EventArgse){ShowForm(new frmBorrow());}private void协助ToolStripMenuItem_Click(objectsender,EventArgse){ShowForm(new frmAbout());}private void退出ToolStripMenuItem_Click(objectsender,EventArgse){Application.Exit();}}}3) 馆长窗口usingSystem;usingSystem.Collections.Generic;usingSystem.ComponentModel;usingSystem.Data;usingSystem.Drawing;usingSystem.Linq;usingSystem.Text;usingSystem.Windows.Forms;namespaceprjTSGL.TSGL_UI{public partial class frmManager:Form{publicfrmManager(){InitializeComponent();}private voidShowForm(FormfrmToShow){this.Cursor=Cursors.WaitCursor;foreach(FormfrmChildin this.MdiChildren){if(frmChild.GetType()==frmToShow.GetType()){frmToShow.Dispose();frmChild.Activate();this.Cursor=Cursors.Default;return;}}frmToShow.MdiParent=this;frmToShow.Show();this.Cursor=Cursors.Default;}private voidfrmManager_FormClosed(objectsender,FormClosedEventArgse){Application.Exit();}private void管理员信息管理ToolStripMenuItem_Click_1(objectsender,EventArgse){ShowForm(new frmSelectAdmin());}private void系统设置ToolStripMenuItem_Click_1(objectsender,EventArgse){ShowForm(new frmSys());}private void有关ToolStripMenuItem_Click(objectsender,EventArgse){ShowForm(new frmAbout());}private void退出ToolStripMenuItem_Click_1(objectsender,EventArgse){Application.Exit();}}}4) 有关窗口usingSystem;usingSystem.Collections.Generic;usingSystem.ComponentModel;usingSystem.Data;usingSystem.Drawing;usingSystem.Linq;usingSystem.Text;usingSystem.Windows.Forms;namespaceprjTSGL.TSGL_UI{public partial class frmAbout:Form{publicfrmAbout(){InitializeComponent();}private voidbutton1_Click(objectsender,EventArgse){this.Close();}}}5) 新增图书窗口usingSystem;usingSystem.Collections.Generic;usingSystem.ComponentModel;usingSystem.Data;usingSystem.Drawing;usingSystem.Linq;usingSystem.Text;usingSystem.Windows.Forms;usingprjTSGL.ClassLib.DBAccess;namespaceprjTSGL.TSGL_UI{public partial class frmAddNewBook:Form{publicfrmAddNewBook(){InitializeComponent();}private boolValidatInput(){if(textBox1.Text==""){MessageBox.Show("请输入图书编号!","输入提醒",MessageBoxButtons.OK,MessageBoxIcon.Information);textBox1.Focus();return false;}if(textBox2.Text==""){MessageBox.Show("请输入图书名称!","输入提醒",MessageBoxButtons.OK,MessageBoxIcon.Information);textBox2.Focus();return false;}if(textBox3.Text==""){MessageBox.Show("请输入图书数目!","输入提醒",MessageBoxButtons.OK,MessageBoxIcon.Information);textBox3.Focus();return false;}if(comboBox1.Text==""){MessageBox.Show("请选择图书类别!","输入提醒",MessageBoxButtons.OK,MessageBoxIcon.Information);textBox3.Focus();return false;}return true;}private voidbtnOK_Click_1(objectsender,EventArgse){if(ValidatInput()){//stringid=textBox1.Text;//stringname=textBox2.Text;//stringNumber=textBox3.Text;//stringsore=comboBox1.Text;stringsql="SELECT*FROMBmanageWHEREbId='"+textBox1.Text.Trim()+"'";DataTabledt=clsGlobalVar.GetDataTable(sql);if(dt.Rows.Count==0){stringSQL="insertintoBmanage(bId,bName,bNumber,bSore)values('"+textBox1.Text.Trim()+"','"+textBox2.Text.Trim()+"','"+textBox3.Text.Trim()+"','"+comboBox1.Text.Trim()+"')";try{boolresult=clsGlobalVar.ExecSQL(SQL);if(result){MessageBox.Show("添加成功!","操作提醒",MessageBoxButtons.OK,MessageBoxIcon.Information);textBox1.Text="";textBox2.Text="";textBox3.Text="";comboBox1.Text="";textBox1.Focus();}else{MessageBox.Show("添加失败!","操作提醒",MessageBoxButtons.OK,MessageBoxIcon.Error);}}catch(Exceptionex){MessageBox.Show("操作数据库出错!","操作演示",MessageBoxButtons.OK,MessageBoxIcon.Error);Console.WriteLine(ex.Message);}}else{MessageBox.Show("图书编号已存在!","操作提醒",MessageBoxButtons.OK,MessageBoxIcon.Information);textBox1.Focus();}}}private voidbtnCancel_Click(objectsender,EventArgse){this.Close();}}}6) 新增管理员、查找及修改窗口usingSystem;usingSystem.Collections.Generic;usingSystem.ComponentModel;usingSystem.Data;usingSystem.Drawing;usingSystem.Linq;usingSystem.Text;usingSystem.Windows.Forms;usingprjTSGL.ClassLib.DBAccess;namespaceprjTSGL.TSGL_UI{public partial class frmSelectAdmin:Form{publicfrmSelectAdmin(){InitializeComponent();}stringname="";stringSQL="";stringPWD="";stringAge="";stringSex="";stringTel="";stringRole="";private voidSelectAdmin(){stringstrfilter="";stringSQL="selectmNameAS顾客名,mPwdAS密码,mAgeAS年龄,mSexAS性别,mNumberAS,mRoleAS角色fromMadmin";if(txtName.Text=="")strfilter="";elsestrfilter="wheremName='"+txtName.Text.Trim()+"'";try{DataTabledt=clsGlobalVar.GetDataTable(SQL+strfilter);intintIndex=0;if(dt.Rows.Count==0){MessageBox.Show("抱歉,没有您要找旳顾客!","成果提醒",MessageBoxButtons.OK,MessageBoxIcon.Information);txtName.Text="";txtPWD.Text="";txtAge.Text="";cboSex.Text="";txtTel.Text="";cboRole.Text="";}else{{LV.Columns.Clear();LV.Items.Clear();LV.Columns.Add("序号",100,HorizontalAlignment.Center);for(intintJ=0;intJ<dt.Columns.Count;intJ++){LV.Columns.Add(dt.Columns[intJ].ColumnName,200,HorizontalAlignment.Center);}for(intintI=0;intI<dt.Rows.Count;intI++){intIndex=intI+1;LV.Items.Add(intIndex.ToString());LV.Items[intI].SubItems.Add(dt.Rows[intI]["顾客名"].ToString().Trim());LV.Items[intI].SubItems.Add(dt.Rows[intI]["密码"].ToString().Trim());LV.Items[intI].SubItems.Add(dt.Rows[intI]["年龄"].ToString().Trim());LV.Items[intI].SubItems.Add(dt.Rows[intI]["性别"].ToString().Trim());LV.Items[intI].SubItems.Add(dt.Rows[intI][""].ToString().Trim());LV.Items[intI].SubItems.Add(dt.Rows[intI]["角色"].ToString().Trim());}}}}//连接数据库,将数据读取出放入MadminDatacatch(Exceptionex){MessageBox.Show("查询数据库出错!","提醒",MessageBoxButtons.OK,MessageBoxIcon.Error);Console.WriteLine(ex.Message);}}private voidbtnSearch_Click(objectsender,EventArgse){SelectAdmin();//调用函数}//实现修改功能private voidbtnUpdata_Click(objectsender,EventArgse){if(txtName.Text==""||cboRole.Text==""){MessageBox.Show("请选择要修改旳顾客!");}else{SQL="UPDATEMadminSETmName='"+txtName.Text.Trim()+"',mPwd='"+txtPWD.Text.Trim()+"',mAge='"+txtAge.Text.Trim()+"',mSex='"+cboSex.Text.Trim()+"',mNumber='"+txtTel.Text.Trim()+"',mRole='"+cboRole.Text.Trim()+"'wheremName='"+name+"'ANDmPwd='"+PWD+"'ANDmAge='"+Age+"'ANDmSex='"+Sex+"'ANDmNumber='"+Tel+"'ANDmRole='"+Role+"'";try{boolresult=clsGlobalVar.ExecSQL(SQL);if(result){//txtName.Text="";txtPWD.Text="";txtAge.Text="";cboSex.Text="";txtTel.Text="";cboRole.Text="";MessageBox.Show("修改已成功");SelectAdmin();}else{MessageBox.Show("更新失败!","操作提醒",MessageBoxButtons.OK,MessageBoxIcon.Error);}}catch(Exceptionex){MessageBox.Show("操作数据库出错!","操作演示",MessageBoxButtons.OK,MessageBoxIcon.Error);Console.WriteLine(ex.Message);}}}private voidbtnExit_Click(objectsender,EventArgse){this.Close();}private voidLV_SelectedIndexChanged_1(objectsender,EventArgse){txtName.Text=LV.FocusedItem.SubItems[1].Text.Trim();txtPWD.Text=LV.FocusedItem.SubItems[2].Text.Trim();txtAge.Text=LV.FocusedItem.SubItems[3].Text.Trim();cboSex.Text=LV.FocusedItem.SubItems[4].Text.Trim();txtTel.Text=LV.FocusedItem.SubItems[5].Text.Trim();cboRole.Text=LV.FocusedItem.SubItems[6].Text.Trim();name=LV.FocusedItem.SubItems[1].Text.Trim();PWD=LV.FocusedItem.SubItems[2].Text.Trim();Age=LV.FocusedItem.SubItems[3].Text.Trim();Sex=LV.FocusedItem.SubItems[4].Text.Trim();Tel=LV.FocusedItem.SubItems[5].Text.Trim();Role=LV.FocusedItem.SubItems[6].Text.Trim();}private voidfrmSelectAdmin_Load(objectsender,EventArgse){this.btnSearch_Click(sender,e);}private voidbtnAdd_Click(objectsender,EventArgse){if(txtName.Text==""||txtPWD.Text==""||txtAge.Text==""||cboSex.Text==""||txtTel.Text==""||cboRole.Text==""){}

MessageBox.Show("请至少输入顾客名,密码和角色!");else{SQL="SELECTmName,mPwd,mAge,mSex,mNumber,mRolefromMadminWHEREmName='"+txtName.Text.Trim()+"'";DataTabledt=clsGlobalVar.GetDataTable(SQL);if(dt.Rows.Count==0){SQL="INSERTINTOMadminVALUES('"+txtName.Text.Trim()+"','"+txtPWD.Text.Trim()+"','"+txtAge.Text.Trim()+"','"+cboSex.Text.Trim()+"','"+txtTel.Text.Trim()+"','"+cboRole.Text.Trim()+"')";if(clsGlobalVar.ExecSQL(SQL)==true){//txtName.Text="";txtPWD.Text="";txtAge.Text="";cboSex.Text="";txtTel.Text="";cboRole.Text="";MessageBox.Show("成功添加新管理员!");SelectAdmin();}else{Exceptionex=new Exception();MessageBox.Show(ex.Message.ToString());}}else{MessageBox.Show("顾客名已存在,请选择其他顾客名!","成果提醒",MessageBoxButtons.OK,MessageBoxIcon.Information);txtName.Text="";}}}private voidbtnDelete_Click(objectsender,EventArgse){if(txtName.Text==""||cboRole.Text==""){MessageBox.Show("请选择要删除旳管理员顾客!");}else{DialogResultdr=MessageBox.Show("此操作不可撤销,确定要删除此顾客信息吗?","提醒",MessageBoxButtons.YesNo,MessageBoxIcon.Question);if(dr==DialogResult.Yes){SQL="DELETEFROMMadminWHEREmName='"+name+"'ANDmPwd='"+PWD+"'ANDmAge='"+Age+"'ANDmSex='"+Sex+"'ANDmNumber='"+Tel+"'ANDmRole='"+Role+"'";if(clsGlobalVar.ExecSQL(SQL)==true){MessageBox.Show("成功删除此管理信息!");SelectAdmin();}else{Exceptionex=new Exception();MessageBox.Show(ex.Message.ToString());}}}}private voidbtnReset_Click(objectsender,EventArgse){txtName.Text="";txtPWD.Text="";txtAge.Text="";cboSex.Text="";txtTel.Text="";cboRole.Text="";}}}7) 新增读者、查找及修改窗口usingSystem;usingSystem.Collections.Generic;usingSystem.ComponentModel;usingSystem.Data;usingSystem.Drawing;usingSystem.Linq;usingSystem.Text;usingSystem.Windows.Forms;usingprjTSGL.ClassLib.DBAccess;namespaceprjTSGL.TSGL_UI{public partial class frmUpdateReader:Form{publicfrmUpdateReader(){InitializeComponent();}stringSno="";stringPwd="";stringAge="";stringname="";stringSex="";stringState="";stringAdress="";stringNumber="";stringEmail="";stringGrade="";stringClass="";stringRole="";//查找学生读者private voidSelectStudent(){stringstrfilter="";stringSQL="selectrSnoAS读者编号,rNameAS读者姓名,rPwdAS密码,rAgeAS年龄,rSexAS性别,rStateAS借书状态,rAdressAS地址,rNumberAS,rEmailAS邮箱,rGradeAS年级,rClassAS班级,rRoleAS角色fromReader";if(txtReaderName.Text=="")strfilter="";elsestrfilter="whererName='"+txtReaderName.Text.Trim()+"'";try{DataTabledt=clsGlobalVar.GetDataTable(SQL+strfilter);intintIndex=0;if(dt.Rows.Count==0){MessageBox.Show("抱歉,没有您要找旳读者信息!","成果提醒",MessageBoxButtons.OK,MessageBoxIcon.Information);}else{LV.Columns.Clear();LV.Items.Clear();LV.Columns.Add("序号",100,HorizontalAlignment.Center);for(intintJ=0;intJ<dt.Columns.Count;intJ++){LV.Columns.Add(dt.Columns[intJ].ColumnName,200,HorizontalAlignment.Center);}for(intintI=0;intI<dt.Rows.Count;intI++){intIndex=intI+1;LV.Items.Add(intIndex.ToString());for(intj=1;j<dt.Columns.Count;j++){LV.Items[intI].SubItems.Add(dt.Rows[intI][j].ToString());}//LV.Items[intI].SubItems.Add(dt.Rows[intI]["读者编号"].ToString());//LV.Items[intI].SubItems.Add(dt.Rows[intI]["读者姓名"].ToString());//LV.Items[intI].SubItems.Add(dt.Rows[intI]["密码"].ToString());//LV.Items[intI].SubItems.Add(dt.Rows[intI]["年龄"].ToString());//LV.Items[intI].SubItems.Add(dt.Rows[intI]["性别"].ToString());//LV.Items[intI].SubItems.Add(dt.Rows[intI]["借书状态"].ToString());//LV.Items[intI].SubItems.Add(dt.Rows[intI]["地址"].ToString());//LV.Items[intI].SubItems.Add(dt.Rows[intI][""].ToString());//LV.Items[intI].SubItems.Add(dt.Rows[intI]["邮箱"].ToString());//LV.Items[intI].SubItems.Add(dt.Rows[intI]["年级"].ToString());//LV.Items[intI].SubItems.Add(dt.Rows[intI]["班级"].ToString());//LV.Items[intI].SubItems.Add(dt.Rows[intI]["角色"].ToString());}}}catch(Exceptionex){MessageBox.Show("查询数据库出错!","提醒",MessageBoxButtons.OK,MessageBoxIcon.Error);Console.WriteLine(ex.Message);}}//实现查找功能private voidbtnSearch_Click(objectsender,EventArgse){SelectStudent();}//实现修改功能private voidbtnUpdata_Click(objectsender,EventArgse){if(textBox2.Text==""){MessageBox.Show("请选择要修改旳顾客!");}else//stringsql="SELECT*fromReaderWHERErSno='"+textBox2.Text.Trim()+"'";//DataTabledt=clsGlobalVar.GetDataTable(sql);//if(dt.Rows.Count==0)//{{stringSQL="UPDATEReaderSETrSno='"+textBox2.Text.Trim()+"',rPwd='"+textBox3.Text.Trim()+"',rAge='"+textBox1.Text.Trim()+"',rName='"+txtReaderName.Text.Trim()+"',rSex='"+cboSex.Text.Trim()+"',rState='"+textBox4.Text.Trim()+"',rAdress='"+textBox5.Text.Trim()+"',rNumber='"+textBox6.Text.Trim()+"',rEmail='"+textBox7.Text.Trim()+"',rGrade='"+textBox8.Text.Trim()+"',rClass='"+textBox9.Text.Trim()+"',rRole='"+cboRole.Text.Trim()+"'";stringstrfilter="whererSno='"+Sno+"'";try{boolresult=clsGlobalVar.ExecSQL(SQL+strfilter);if(result){textBox2.Text="";textBox3.Text="";textBox1.Text="";cboSex.Text="";textBox4.Text="";textBox5.Text="";textBox6.Text="";textBox7.Text="";textBox8.Text="";textBox9.Text="";cboRole.Text="";MessageBox.Show("修改已成功");SelectStudent();}else{MessageBox.Show("读者信息不存在!","操作提醒",MessageBoxButtons.OK,MessageBoxIcon.Error);}}catch(Exceptionex){MessageBox.Show("操作数据库出错!","操作演示",MessageBoxButtons.OK,MessageBoxIcon.Error);Console.WriteLine(ex.Message);}}//}//else//{//MessageBox.Show("顾客名已存在,请选择其他顾客名!","成果提醒",MessageBoxButtons.OK,MessageBoxIcon.Information);//textBox2.Text="";//}}private voidbtnExit_Click(objectsender,EventArgse){}

this.Close();private voidLV_SelectedIndexChanged(objectsender,EventArgse){textBox2.Text=LV.FocusedItem.SubItems[1].Text.Trim();txtReaderName.Text=LV.FocusedItem.SubItems[2].Text.Trim();textBox3.Text=LV.FocusedItem.SubItems[3].Text.Trim();textBox1.Text=LV.FocusedItem.SubItems[4].Text.Trim();cboSex.Text=LV.FocusedItem.SubItems[5].Text.Trim();textBox4.Text=LV.FocusedItem.SubItems[6].Text.Trim();textBox5.Text=LV.FocusedItem.SubItems[7].Text.Trim();textBox6.Text=LV.FocusedItem.SubItems[8].Text.Trim();textBox7.Text=LV.FocusedItem.SubItems[9].Text.Trim();textBox8.Text=LV.FocusedItem.SubItems[10].Text.Trim();textBox9.Text=LV.FocusedItem.SubItems[11].Text.Trim();cboRole.Text=LV.FocusedItem.SubItems[12].Text.Trim();Sno=LV.FocusedItem.SubItems[1].Text.Trim();name=LV.FocusedItem.SubItems[2].Text.Trim();Pwd=LV.FocusedItem.SubItems[3].Text.Trim();Age=LV.FocusedItem.SubItems[4].Text.Trim();Sex=LV.FocusedItem.SubItems[5].Text.Trim();State=LV.FocusedItem.SubItems[6].Text.Trim();Adress=LV.FocusedItem.SubItems[7].Text.Trim();Number=LV.FocusedItem.SubItems[8].Text.Trim();Email=LV.FocusedItem.SubItems[9].Text.Trim();Grade=LV.FocusedItem.SubItems[10].Text.Trim();Class=LV.FocusedItem.SubItems[11].Text.Trim();Role=LV.FocusedItem.SubItems[12].Text.Trim();}private voidbtnReset_Click(objectsender,EventArgse){textBox2.Text="";textBox3.Text="";txtReaderName.Text="";textBox1.Text="";cboSex.Text="";textBox4.Text="";textBox5.Text="";textBox6.Text="";textBox7.Text="";textBox8.Text="";textBox9.Text="";cboRole.Text="";}private voidbtnAdd_Click(objectsender,EventArgse){stringSQL="";if(textBox2.Text==""||textBox3.Text==""||txtReaderName.Text==""||textBox4.Text==""||textBox5.Text==""){MessageBox.Show("请至少输入读者姓名,顾客名,密码,借书状态和角色!");}else{stringsql="SELECT*fromReaderWHERErSno='"+textBox2.Text.Trim()+"'";DataTabledt=clsGlobalVar.GetDataTable(sql);if(dt.Rows.Count==0){if(cboRole.Text.Trim()=="教师")SQL="INSERTINTOReader(rSno,rPwd,rName,rAge,rSex,rState,rAdress,rNumber,rEmail,rGrade,rClass,rRole)VALUES('"+textBox2.Text.Trim()+"','"+textBox3.Text.Trim()+"','"+txtReaderName.Text.Trim()+"','"+textBox1.Text.Trim()+"','"+cboSex.Text.Trim()+"','"+textBox4.Text.Trim()+"','"+textBox5.Text.Trim()+"','"+textBox6.Text.Trim()+"','"+textBox7.Text.Trim()+"','"+"NULL"+"','"+"NULL"+"','"+cboRole.Text.Trim()+"')";elseSQL="INSERTINTOReader(rSno,rPwd,rName,rAge,rSex,rState,rAdress,rNumber,rEmail,rGrade,rClass,rRole)VALUES('"+textBox2.Text.Trim()+"','"+textBox3.Text.Trim()+"','"+txtReaderName.Text.Trim()+"','"+textBox1.Text.Trim()+"','"+cboSex.Text.Trim()+"','"+textBox4.Text.Trim()+"','"+textBox5.Text.Trim()+"','"+textBox6.Text.Trim()+"','"+textBox7.Text.Trim()+"','"+textBox8.Text.Trim()+"','"+textBox9.Text.Trim()+"','"+cboRole.Text.Trim()+"')";if(clsGlobalVar.ExecSQL(SQL)==true){textBox2.Text="";textBox3.Text="";textBox1.Text="";cboSex.Text="";textBox4.Text="";textBox5.Text="";textBox6.Text="";textBox7.Text="";textBox8.Text="";textBox9.Text="";cboRole.Text="";MessageBox.Show("成功添加此顾客!");SelectStu

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论