图书管理系统源码C版.doc

上传人:新** 文档编号:544753380 上传时间:2022-10-28 格式:DOC 页数:71 大小:159.04KB
返回 下载 相关 举报
图书管理系统源码C版.doc_第1页
第1页 / 共71页
图书管理系统源码C版.doc_第2页
第2页 / 共71页
图书管理系统源码C版.doc_第3页
第3页 / 共71页
图书管理系统源码C版.doc_第4页
第4页 / 共71页
图书管理系统源码C版.doc_第5页
第5页 / 共71页
点击查看更多>>
资源描述

《图书管理系统源码C版.doc》由会员分享,可在线阅读,更多相关《图书管理系统源码C版.doc(71页珍藏版)》请在金锄头文库上搜索。

1、登录界面:using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;using System.Data.SqlClient;namespace book public partial class login : Form public string password; /用来存储密码 public login() InitializeCom

2、ponent(); private void button2_Click(object sender, EventArgs e) Application.Exit(); private bool yanzhengshuru() password = textBox3.Text; if (Typename.Text.Trim() = ) MessageBox.Show(请选择登录类型, 登录提醒, MessageBoxButtons.OK, MessageBoxIcon.Information); Typename.Focus(); return false; else if (loginid.

3、Text.Trim() = ) MessageBox.Show(请输入顾客名, 登录提醒, MessageBoxButtons.OK, MessageBoxIcon.Information); loginid.Focus(); return false; else if (password = ) MessageBox.Show(请输入密码, 登录提醒, MessageBoxButtons.OK, MessageBoxIcon.Information); textBox3.Focus(); return false; else return true; private void button1

4、_Click(object sender, EventArgs e) userhelper.adminid= loginid.Text; /顾客账号 password = textBox3.Text;/顾客密码 if (yanzhengshuru() if (Typename.Text.Trim() = 管理员) string sql = string.Format(Select count(*) from admin where adminId=0 and adminpass=1, loginid.Text, password); try SqlCommand command = new S

5、qlCommand(sql, Dbhelper.connection); Dbhelper.connection.Open(); int count = (int)command.ExecuteScalar(); if (count 1) MessageBox.Show(顾客或密码不存在!); /result = false; else admin admin = new admin(); admin.Show(); catch (Exception ex) MessageBox.Show(操作数据库出错!); Console.WriteLine(ex.Message); finally Db

6、helper.connection.Close(); if (Typename.Text.Trim() = 借阅者) userhelper.readerid =Convert .ToString (loginid.Text); string sql = string.Format(Select count(*) from reader where readerId=0 and readerpass=1, userhelper.readerid,textBox3.Text); try / 创立 Command 对象 SqlCommand command = new SqlCommand(sql,

7、 Dbhelper.connection); / 打开数据库连接 Dbhelper.connection.Open(); / 验证与否为合法顾客 int count = (int)command.ExecuteScalar(); if (count 1) MessageBox.Show(顾客或密码不存在!); /result = false; else reader reader = new reader(); reader.Show(); catch (Exception ex) MessageBox.Show(操作数据库出错!); Console.WriteLine(ex.Message)

8、; /result = false; finally / 关闭数据库连接 Dbhelper.connection.Close(); private void login_Load(object sender, EventArgs e) 读者界面;using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;using System.Data.Sql;using System.Data.SqlClient;namespace book public partial class reader : Form public reader() InitializeComponent(); private void button3_Click(object sender, EventArgs e) string id =Convert.ToString (textBox1.Text); if (id!=userhelper.readerid) Messag

展开阅读全文
相关资源
正为您匹配相似的精品文档
相关搜索

最新文档


当前位置:首页 > 中学教育 > 其它中学文档

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号