C#图书馆管理信息系统

时间:2012-12-02 14:30:11
【文件属性】:

文件名称:C#图书馆管理信息系统

文件大小:664KB

文件格式:RAR

更新时间:2012-12-02 14:30:11

管理系统,C#

附登陆代码: using System; using System.Drawing; using System.Collections; using System.ComponentModel; using System.Windows.Forms; using System.Data; using System.Data.SqlClient; namespace 图书馆管理信息系统 { ///

/// Form1 的摘要说明。 /// public class login : System.Windows.Forms.Form { private System.Windows.Forms.Label label1; private System.Windows.Forms.Label label2; private System.Windows.Forms.Label label3; private System.Windows.Forms.Button button1; private System.Windows.Forms.Button button2; private System.Windows.Forms.Button button3; private System.Windows.Forms.TextBox userid; private System.Data.SqlClient.SqlConnection sqlConnection1; private System.Data.SqlClient.SqlDataAdapter sqlDataAdapter1; private System.Data.SqlClient.SqlCommand sqlSelectCommand1; private System.Data.SqlClient.SqlCommand sqlInsertCommand1; private System.Data.SqlClient.SqlCommand sqlUpdateCommand1; private System.Data.SqlClient.SqlCommand sqlDeleteCommand1; private 图书馆管理信息系统.DataSet1 dataSet11; private System.Windows.Forms.TextBox textboxpass; /// /// 必需的设计器变量。 /// private System.ComponentModel.Container components = null; public login() { // // Windows 窗体设计器支持所必需的 // InitializeComponent(); // // TODO: 在 InitializeComponent 调用后添加任何构造函数代码 // } /// /// 清理所有正在使用的资源。 /// protected override void Dispose( bool disposing ) { if( disposing ) { if (components != null) { components.Dispose(); } } base.Dispose( disposing ); } #region Windows 窗体设计器生成的代码 /// /// 设计器支持所需的方法 - 不要使用代码编辑器修改 /// 此方法的内容。 /// private void InitializeComponent() { System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(login)); this.label1 = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label(); this.userid = new System.Windows.Forms.TextBox(); this.textboxpass = new System.Windows.Forms.TextBox(); this.label3 = new System.Windows.Forms.Label(); this.button1 = new System.Windows.Forms.Button(); this.button2 = new System.Windows.Forms.Button(); this.button3 = new System.Windows.Forms.Button(); this.sqlConnection1 = new System.Data.SqlClient.SqlConnection(); this.sqlDataAdapter1 = new System.Data.SqlClient.SqlDataAdapter(); this.sqlDeleteCommand1 = new System.Data.SqlClient.SqlCommand(); this.sqlInsertCommand1 = new System.Data.SqlClient.SqlCommand(); this.sqlSelectCommand1 = new System.Data.SqlClient.SqlCommand(); this.sqlUpdateCommand1 = new System.Data.SqlClient.SqlCommand(); this.dataSet11 = new 图书馆管理信息系统.DataSet1(); ((System.ComponentModel.ISupportInitialize)(this.dataSet11)).BeginInit(); this.SuspendLayout(); // // label1 // this.label1.Font = new System.Drawing.Font("华文新魏", 26.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134))); this.label1.Location = new System.Drawing.Point(46, 104); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(335, 51); this.label1.TabIndex = 0; this.label1.Text = "图书馆管理信息系统"; // // label2 // this.label2.Location = new System.Drawing.Point(120, 195); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(48, 16); this.label2.TabIndex = 1; this.label2.Text = "用户名"; // // userid // this.userid.Location = new System.Drawing.Point(184, 187); this.userid.Name = "userid"; this.userid.Size = new System.Drawing.Size(96, 21); this.userid.TabIndex = 2; // // textboxpass // this.textboxpass.Location = new System.Drawing.Point(184, 227); this.textboxpass.Name = "textboxpass"; this.textboxpass.PasswordChar = '*'; this.textboxpass.Size = new System.Drawing.Size(96, 21); this.textboxpass.TabIndex = 3; // // label3 // this.label3.Location = new System.Drawing.Point(120, 227); this.label3.Name = "label3"; this.label3.Size = new System.Drawing.Size(48, 16); this.label3.TabIndex = 4; this.label3.Text = "密 码"; // // button1 // this.button1.Location = new System.Drawing.Point(88, 275); this.button1.Name = "button1"; this.button1.Size = new System.Drawing.Size(64, 24); this.button1.TabIndex = 5; this.button1.Text = "登陆"; this.button1.Click += new System.EventHandler(this.button1_Click); // // button2 // this.button2.Location = new System.Drawing.Point(184, 275); this.button2.Name = "button2"; this.button2.Size = new System.Drawing.Size(64, 24); this.button2.TabIndex = 6; this.button2.Text = "退出"; this.button2.Click += new System.EventHandler(this.button2_Click); // // button3 // this.button3.Location = new System.Drawing.Point(280, 275); this.button3.Name = "button3"; this.button3.Size = new System.Drawing.Size(64, 24); this.button3.TabIndex = 7; this.button3.Text = "修改密码"; this.button3.Click += new System.EventHandler(this.button3_Click); // // sqlConnection1 // this.sqlConnection1.ConnectionString = "workstation id=\"WUZHIHUI-666666\";packet size=4096;user id=sa;data source=\"WUZHIHU" + "I-666666\";persist security info=False;initial catalog=book"; this.sqlConnection1.FireInfoMessageEventOnUserErrors = false; // // sqlDataAdapter1 // this.sqlDataAdapter1.DeleteCommand = this.sqlDeleteCommand1; this.sqlDataAdapter1.InsertCommand = this.sqlInsertCommand1; this.sqlDataAdapter1.SelectCommand = this.sqlSelectCommand1; this.sqlDataAdapter1.TableMappings.AddRange(new System.Data.Common.DataTableMapping[] { new System.Data.Common.DataTableMapping("Table", "employee", new System.Data.Common.DataColumnMapping[] { new System.Data.Common.DataColumnMapping("员工编号", "员工编号"), new System.Data.Common.DataColumnMapping("姓名", "姓名"), new System.Data.Common.DataColumnMapping("性别", "性别"), new System.Data.Common.DataColumnMapping("职务", "职务"), new System.Data.Common.DataColumnMapping("密码", "密码")})}); this.sqlDataAdapter1.UpdateCommand = this.sqlUpdateCommand1; // // sqlDeleteCommand1 // this.sqlDeleteCommand1.CommandText = "DELETE FROM employee WHERE (员工编号 = @Original_员工编号) AND (姓名 = @Original_姓名) AND (密" + "码 = @Original_密码) AND (性别 = @Original_性别) AND (职务 = @Original_职务)"; this.sqlDeleteCommand1.Connection = this.sqlConnection1; this.sqlDeleteCommand1.Parameters.AddRange(new System.Data.SqlClient.SqlParameter[] { new System.Data.SqlClient.SqlParameter("@Original_员工编号", System.Data.SqlDbType.VarChar, 10, System.Data.ParameterDirection.Input, false, ((byte)(0)), ((byte)(0)), "员工编号", System.Data.DataRowVersion.Original, null), new System.Data.SqlClient.SqlParameter("@Original_姓名", System.Data.SqlDbType.VarChar, 10, System.Data.ParameterDirection.Input, false, ((byte)(0)), ((byte)(0)), "姓名", System.Data.DataRowVersion.Original, null), new System.Data.SqlClient.SqlParameter("@Original_密码", System.Data.SqlDbType.VarChar, 6, System.Data.ParameterDirection.Input, false, ((byte)(0)), ((byte)(0)), "密码", System.Data.DataRowVersion.Original, null), new System.Data.SqlClient.SqlParameter("@Original_性别", System.Data.SqlDbType.VarChar, 2, System.Data.ParameterDirection.Input, false, ((byte)(0)), ((byte)(0)), "性别", System.Data.DataRowVersion.Original, null), new System.Data.SqlClient.SqlParameter("@Original_职务", System.Data.SqlDbType.VarChar, 10, System.Data.ParameterDirection.Input, false, ((byte)(0)), ((byte)(0)), "职务", System.Data.DataRowVersion.Original, null)}); // // sqlInsertCommand1 // this.sqlInsertCommand1.CommandText = "INSERT INTO employee(员工编号, 姓名, 性别, 职务, 密码) VALUES (@员工编号, @姓名, @性别, @职务, @密码); SE" + "LECT 员工编号, 姓名, 性别, 职务, 密码 FROM employee WHERE (员工编号 = @员工编号)"; this.sqlInsertCommand1.Connection = this.sqlConnection1; this.sqlInsertCommand1.Parameters.AddRange(new System.Data.SqlClient.SqlParameter[] { new System.Data.SqlClient.SqlParameter("@员工编号", System.Data.SqlDbType.VarChar, 10, "员工编号"), new System.Data.SqlClient.SqlParameter("@姓名", System.Data.SqlDbType.VarChar, 10, "姓名"), new System.Data.SqlClient.SqlParameter("@性别", System.Data.SqlDbType.VarChar, 2, "性别"), new System.Data.SqlClient.SqlParameter("@职务", System.Data.SqlDbType.VarChar, 10, "职务"), new System.Data.SqlClient.SqlParameter("@密码", System.Data.SqlDbType.VarChar, 6, "密码")}); // // sqlSelectCommand1 // this.sqlSelectCommand1.CommandText = "SELECT 员工编号, 姓名, 性别, 职务, 密码 FROM employee"; this.sqlSelectCommand1.Connection = this.sqlConnection1; // // sqlUpdateCommand1 // this.sqlUpdateCommand1.CommandText = resources.GetString("sqlUpdateCommand1.CommandText"); this.sqlUpdateCommand1.Connection = this.sqlConnection1; this.sqlUpdateCommand1.Parameters.AddRange(new System.Data.SqlClient.SqlParameter[] { new System.Data.SqlClient.SqlParameter("@员工编号", System.Data.SqlDbType.VarChar, 10, "员工编号"), new System.Data.SqlClient.SqlParameter("@姓名", System.Data.SqlDbType.VarChar, 10, "姓名"), new System.Data.SqlClient.SqlParameter("@性别", System.Data.SqlDbType.VarChar, 2, "性别"), new System.Data.SqlClient.SqlParameter("@职务", System.Data.SqlDbType.VarChar, 10, "职务"), new System.Data.SqlClient.SqlParameter("@密码", System.Data.SqlDbType.VarChar, 6, "密码"), new System.Data.SqlClient.SqlParameter("@Original_员工编号", System.Data.SqlDbType.VarChar, 10, System.Data.ParameterDirection.Input, false, ((byte)(0)), ((byte)(0)), "员工编号", System.Data.DataRowVersion.Original, null), new System.Data.SqlClient.SqlParameter("@Original_姓名", System.Data.SqlDbType.VarChar, 10, System.Data.ParameterDirection.Input, false, ((byte)(0)), ((byte)(0)), "姓名", System.Data.DataRowVersion.Original, null), new System.Data.SqlClient.SqlParameter("@Original_密码", System.Data.SqlDbType.VarChar, 6, System.Data.ParameterDirection.Input, false, ((byte)(0)), ((byte)(0)), "密码", System.Data.DataRowVersion.Original, null), new System.Data.SqlClient.SqlParameter("@Original_性别", System.Data.SqlDbType.VarChar, 2, System.Data.ParameterDirection.Input, false, ((byte)(0)), ((byte)(0)), "性别", System.Data.DataRowVersion.Original, null), new System.Data.SqlClient.SqlParameter("@Original_职务", System.Data.SqlDbType.VarChar, 10, System.Data.ParameterDirection.Input, false, ((byte)(0)), ((byte)(0)), "职务", System.Data.DataRowVersion.Original, null)}); // // dataSet11 // this.dataSet11.DataSetName = "DataSet1"; this.dataSet11.Locale = new System.Globalization.CultureInfo("zh-CN"); this.dataSet11.SchemaSerializationMode = System.Data.SchemaSerializationMode.IncludeSchema; // // login // this.AutoScaleBaseSize = new System.Drawing.Size(6, 14); this.BackColor = System.Drawing.SystemColors.Control; this.ClientSize = new System.Drawing.Size(428, 399); this.Controls.Add(this.button3); this.Controls.Add(this.button2); this.Controls.Add(this.button1); this.Controls.Add(this.label3); this.Controls.Add(this.textboxpass); this.Controls.Add(this.userid); this.Controls.Add(this.label2); this.Controls.Add(this.label1); this.Name = "login"; this.Text = "登陆"; this.Load += new System.EventHandler(this.Form1_Load); ((System.ComponentModel.ISupportInitialize)(this.dataSet11)).EndInit(); this.ResumeLayout(false); this.PerformLayout(); } #endregion /// /// 应用程序的主入口点。 /// [STAThread] static void Main() { Application.Run(new login()); } private void Form1_Load(object sender, System.EventArgs e) { } private void button1_Click(object sender, System.EventArgs e) { SqlCommand myComm=sqlConnection1.CreateCommand(); string employeeNo=userid.Text.Trim(); string password=""; string str=textboxpass.Text.Trim(); string str1 = "select * from employee where 员工编号='" + employeeNo + "'"; //将用户输入的密码做转换,将密码的每个字符的ASCII码加1 for(int i=0;i

网友评论

  • 数据库打不开
  • 还好,大概知道怎么用
  • 很好,对我的学习很有帮助
  • 还不错,有参考价值
  • 能运行,功能还可以~~~
  • 运行起来还不错
  • 还可以,要知道怎么用!!
  • 总的来说不错,但数据库有问题,需要修改。
  • 做得太好了,完全符合一个图书馆管理的要求
  • 这个系统很好,不过我正在找数据口入口……
  • 运行的还行、有些地方用的不太顺手
  • 非常不错,数据库要用附加的方式导入。
  • 总的来说,还不错!谢谢分享!
  • 总的来说,还不错!谢谢分享!
  • 能运行,功能还可以~~~
  • 非常不错,数据库要用附加的方式导入。
  • 数据库好像没用的样子。。。。
  • 参考稍微修改后挺实用的,
  • 做得太好了,完全符合一个图书馆管理的要求