欢迎来到天天文库
浏览记录
ID:22657533
大小:239.00 KB
页数:50页
时间:2018-10-30
《[计算机软件及应用]程序代码》由会员上传分享,免费在线阅读,更多相关内容在应用文档-天天文库。
1、仓储管理系统代码【李彩享、字朝龙】一、窗体(frmLogin)登录的代码程序usingSystem;usingSystem.Collections.Generic;usingSystem.ComponentModel;usingSystem.Data;usingSystem.Data.SqlClient;usingSystem.Drawing;usingSystem.Linq;usingSystem.Text;usingSystem.Windows.Forms;namespaceWMS{publicpartialcl
2、assfrmLogin:Form{publicstaticstringM_str_name;//记录登录用户名字publicstaticstringM_str_pwd;//记录登录用户密码publicstaticstringM_str_right;//记录登录用户的权限publicfrmLogin(){InitializeComponent();}privatevoidfrmLogin_Load(objectsender,EventArgse)//启动窗口时加载用户名{DbOperatordb=newDbOperat
3、or();SqlConnectioncnn=db.GetCon();SqlCommandcmd=newSqlCommand();cmd.CommandType=CommandType.Text;cmd.CommandText="selectUserNamefromtbUserInfo";//cmd.Connection=cnn;cnn.Open();SqlDataReaderdr;dr=cmd.ExecuteReader();if(dr.HasRows){while(dr.Read()){cmbUserList.It
4、ems.Add(dr["UserName"].ToString().Trim());//在控件中显示用户名第-50-页共50页}cmbUserList.Sorted=true;}else{MessageBox.Show("表中无记录!","提示?",MessageBoxButtons.YesNo,MessageBoxIcon.Information);}dr.Close();cnn.Close();}privatevoidbtnCancel_Click(objectsender,EventArgse){if(Mess
5、ageBox.Show("你确定要退出吗?","提示?",MessageBoxButtons.OKCancel,MessageBoxIcon.Question)==DialogResult.OK)this.Close();elsecmbUserList.Focus();return;}privatevoidbtnLoad_Click(objectsender,EventArgse)//用存储过程实现验证登录{DbOperatordb=newDbOperator();SqlConnectioncnn=db.GetCon
6、();SqlCommandcmd=newSqlCommand();cmd.Connection=cnn;cmd.CommandType=CommandType.StoredProcedure;cmd.CommandText="proc_Login";SqlParameterpaUser=newSqlParameter();paUser.ParameterName="@User_Name";paUser.SqlDbType=SqlDbType.VarChar;paUser.Size=50;paUser.Value=cm
7、bUserList.Text.Trim();cmd.Parameters.Add(paUser);SqlParameterpaPwd=newSqlParameter();paPwd.ParameterName="@User_Pwd";paPwd.SqlDbType=SqlDbType.VarChar;paPwd.Size=20;paPwd.Value=txtPwd.Text.Trim();cmd.Parameters.Add(paPwd);SqlParameterpaRe=newSqlParameter();第-50
8、-页共50页paRe.ParameterName="@re";paRe.SqlDbType=SqlDbType.Int;paRe.Value=0;paRe.Direction=System.Data.ParameterDirection.Output;//设置cmd.Parameters.Add(paRe);cnn.Open();cmd.Exe
此文档下载收益归作者所有