图书馆管理信息系统界面与代码.doc

上传人:M****1 文档编号:543462951 上传时间:2023-09-03 格式:DOC 页数:29 大小:15.11MB
返回 下载 相关 举报
图书馆管理信息系统界面与代码.doc_第1页
第1页 / 共29页
图书馆管理信息系统界面与代码.doc_第2页
第2页 / 共29页
图书馆管理信息系统界面与代码.doc_第3页
第3页 / 共29页
图书馆管理信息系统界面与代码.doc_第4页
第4页 / 共29页
图书馆管理信息系统界面与代码.doc_第5页
第5页 / 共29页
点击查看更多>>
资源描述

《图书馆管理信息系统界面与代码.doc》由会员分享,可在线阅读,更多相关《图书馆管理信息系统界面与代码.doc(29页珍藏版)》请在金锄头文库上搜索。

1、- 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 图书馆管理信息系统 public partial class frmLogin : Form public frmLogin() InitializeComponent(

2、); private void btnLogin_Click(object sender, EventArgs e) try if (txtUserName.Text = ) /判断用户是否输入了用户名 MessageBox.Show(用户名不能为空); else if (txtPwd.Text = ) MessageBox.Show(密码不能为空); /判断用户是否输入了密码 else SqlConnection con = DBCon.createCon();/创建数据库连接 con.Open(); SqlCommand cmd = new SqlCommand(select count(

3、*)from Users where UserName= + txtUserName.Text + and UserPwd= + txtPwd.Text + , con); int i = Convert.ToInt32(cmd.ExecuteScalar(); /获取返回值 if (i 0) if (cmbLogin.Text = ) MessageBox.Show(请选择登录界面); cmbLogin.Focus(); return; else if (cmbLogin.Text = 普通用户使用界面) frmMain main = new frmMain(); main.adminnam

4、e = txtUserName.Text; main.admintime = DateTime.Now.ToShortDateString(); main.Show(); this.Hide();/隐藏登录窗体 else ptMain ptmain = new ptMain(); ptmain.adminname = txtUserName.Text; ptmain.Show(); this.Hide(); else MessageBox.Show(用户名或者密码错误!); /弹出提示 catch (Exception ex) MessageBox.Show(ex.ToString(); pr

5、ivate void btnCancel_Click(object sender, EventArgs e) this.Close(); private void txtPwd_KeyPress(object sender, KeyPressEventArgs e) if (e.KeyChar = 13) /判断是否按下Enter键 btnLogin_Click(sender, e); /调用“登录”按钮的Click事件 DBCon.csusing System;using System.Collections.Generic;using System.Text;using System.Da

6、ta.SqlClient;namespace 图书馆管理信息系统 class DBCon public static SqlConnection createCon() /SqlConnection con = new SqlConnection(server=yyw;database=LibDB;uid=sa;pwd= ); SqlConnection con = new SqlConnection(workstation id=-localhost;Integrated Security=SSPI;database=LibDB); return con; using System;usin

7、g System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;namespace 图书馆管理信息系统 public partial class ptMain : Form public ptMain() InitializeComponent(); public string adminname; private void ptMain_Load(object sender,

8、EventArgs e) toolStripStatusLabel2.Text = adminname; toolStripStatusLabel5.Text = DateTime.Now.ToString(); private bool checkChildFrmExist(string childFrmName) foreach (Form childFrm in this.MdiChildren) /用子窗体的Name进行判断,如果存在则将他激活 if (childFrm.Name = childFrmName) if (childFrm.WindowState = FormWindowState.Minimized) childFrm.WindowState = FormWindowState.Normal; childFrm.Activate(); return true; return false; private void toolStripMenuItem1_Click(object sender, EventArgs e) if (MessageBox.Show(确定退出本系统吗?, 提示, MessageBoxButtons.OKCancel, MessageBoxIcon.Asterisk) = DialogResult.OK) this.Close();

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 生活休闲 > 社会民生

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