C#图书馆管理系统Word下载.docx
- 文档编号:20965863
- 上传时间:2023-01-26
- 格式:DOCX
- 页数:24
- 大小:155.35KB
C#图书馆管理系统Word下载.docx
《C#图书馆管理系统Word下载.docx》由会员分享,可在线阅读,更多相关《C#图书馆管理系统Word下载.docx(24页珍藏版)》请在冰豆网上搜索。
失败
成功
2.2创建数据库
3、界面设计
3.1登陆界面
amespace图书管理系统
{
publicpartialclassForm1:
Form
{
publicForm1()
InitializeComponent();
}
publicstaticFormfm=null;
privatestaticintErrorTimes=0;
privatevoidbutton3_Click(objectsender,EventArgse)
this.Close();
privatevoidtextBox1_TextChanged(objectsender,EventArgse)
privatevoidbutton1_Click(objectsender,EventArgse)
if(textBox1.Text=="
"
||textBox2.Text=="
)
{MessageBox.Show("
提示:
请输入用户名和密码!
"
警告"
);
SqlConnectionconn=newSqlConnection("
Server=PC_201402131602;
IntegratedSecurity=true;
DataBase=图书管理系统"
conn.Open();
SqlCommandcmd=newSqlCommand("
select*fromTable_1whereid='
+textBox1.Text.Trim()+"
'
andus='
+textBox2.Text.Trim()+"
conn);
SqlDataReadersdr=cmd.ExecuteReader();
sdr.Read();
if(sdr.HasRows)
MessageBox.Show("
登录成功!
提示"
Form2fm=newForm2();
fm.Show();
this.Hide();
else
ErrorTimes++;
用户名或密码不正确!
您还有"
+(3-ErrorTimes)+"
次输入密码的机会,请重新输入!
如果超过3次,系统将自动关闭"
if(ErrorTimes>
=3)
ErrorTimes=0;
conn.Close();
privatevoidForm1_Load(objectsender,EventArgse)
privatevoidbutton4_Click(objectsender,EventArgse)
select*fromTable_2whereuid='
andusr='
Form7fm=newForm7();
privatevoidbutton2_Click(objectsender,EventArgse)
Form8f1=newForm8();
f1.Show();
privatevoidbutton5_Click(objectsender,EventArgse)
Form10f2=newForm10();
f2.Show();
}
3.2图书管理系统界面
namespace图书管理系统
publicpartialclassForm2:
publicForm2()
Form3f2=newForm3();
您已成功进入----图书信息!
Form4f4=newForm4();
f4.Show();
您已成功进入----还书系统!
Form5f5=newForm5();
f5.Show();
您已成功进入----借书系统!
3.3图书信息
publicpartialclassForm3:
publicForm3()
privatevoidForm3_Load(objectsender,EventArgse)
//TODO:
这行代码将数据加载到表“图书管理系统DataSet.Table_3”中。
您可以根据需要移动或删除它。
this.table_3TableAdapter.Fill(this.图书管理系统DataSet.Table_3);
3.4归还图书
publicpartialclassForm4:
publicForm4()
请输入所借书籍编号!
select*fromTable_4wheresid='
"
该书已还"
sdr.Close();
stringmyinsert="
insertintoTable_4(sid)values('
+textBox1.Text+"
)"
;
SqlCommandmycom=newSqlCommand(myinsert,conn);
mycom.ExecuteNonQuery();
conn.Dispose();
您已还书成功!
privatevoidForm4_Load(objectsender,EventArgse)
这行代码将数据加载到表“图书管理系统DataSet.Table_4”中。
this.table_4TableAdapter.Fill(this.图书管理系统DataSet.Table_4);
Form2f2=newForm2();
3.5已借图书
publicpartialclassForm5:
publicForm5()
privatevoidForm5_Load(objectsender,EventArgse)
该书已借"
您已借书成功!
privatevoidtextBox2_TextChanged(objectsender,EventArgse)
3.6用户信息
publicpartialclassForm6:
publicForm6()
privatevoidForm6_Load(objectsender,EventArgse)
这行代码将数据加载到表“图书管理系统DataSet.Table_1”中。
this.table_1TableAdapter.Fill(this.图书管理系统DataSet.Table_1);
3.7管理员主界面
publicpartialclassForm7:
publicForm7()
Form6f1=newForm6();
您已成功进入----用户信息!
Form9f2=newForm9();
您已成功进入----添加图书系统!
3.8注册界面
publicpartialclassForm8:
publicForm8()
select*fromtable_1whereid='
该用户已注册,请使用其他用户名"
insertintotable_1(id,us)values('
'
+textBox2.Text+"
)"
您已注册成功!
privatevoidForm8_Load(objectsender,EventArgse)
3.9添加图书
publicpartialclassForm9:
publicForm9()
server=PC_201402131602;
database=图书管理系统;
integratedSecurity=true"
stringsql="
insertintoTable_3(sid,sdata,sname)values('
+textBox3.Text+"
SqlCommandcomm=newSqlCommand(sql,conn);
if(conn.State==ConnectionState.Closed)
if(Convert.ToInt32(comm.ExecuteNonQuery())>
0)
label4.Text="
成功!
您已成功添加数据!
失败!
4、系统测试
登陆
借阅图书
归还图书
图书信息
管理员登陆
添加图书
用户信息
5、连接数据库
为数据库BookManage和本系统之间建立一个数据连接。
(1)在服务器资源管理器中右击“数据连接”节点(VS2008中操作)。
在弹出的快捷菜单中执行“添加连接”命令,打开DataLinkProperties对话框。
切换到Provider选项卡,选中列表框中的MicrosoftOLEDBProviderforSQLServer项。
单击“下一步”切换到Connection选项卡。
(2)在其中的第一个下拉列表框中选择数据库所在服务器名称。
输入登录服务器信息后选择数据库BookManage,然后单击测试按钮。
如果测试成功,单击“确定”按钮。
5.1连接数据库
(1)定义数据库连接字符串,代码如下:
PrivatestaticstringConnectString="
DataSource=(local)\\sqlexpress;
DataBase=BookManage.mdf"
(2)创建Connecti
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- C# 图书馆 管理 系统
