基于.net的连锁中心配送系统

时间:2014-01-12 14:50:53
【文件属性】:
文件名称:基于.net的连锁中心配送系统
文件大小:921KB
文件格式:RAR
更新时间:2014-01-12 14:50:53
asp.net sql server 适用于课程设计,初学者参考,毕业论文 namespace STcontract { /// /// Index 的摘要说明。 /// public partial class Index : System.Web.UI.Page { private string STUserNickName; private string STUserPwd; protected void Page_Load(object sender, System.EventArgs e) { // 在此处放置用户代码以初始化页面 } #region Web 窗体设计器生成的代码 override protected void OnInit(EventArgs e) { // // CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。 // InitializeComponent(); base.OnInit(e); } /// /// 设计器支持所需的方法 - 不要使用代码编辑器修改 /// 此方法的内容。 /// private void InitializeComponent() { } #endregion //当用户输入完用户名和密码后点击登陆按钮,就会出发此事件的执行 protected void STFront_Click(object sender, System.EventArgs e) { //去除文本框空格 STUserNickName = STUserName.Text.Trim(); STUserPwd = STPassWord.Text.Trim(); //获得数据库连接字符串 string STconnection = ConfigurationSettings.AppSettings["strconnection"]; //创建数据库连接 SqlConnection STconn = new SqlConnection(STconnection); //打开数据库连接 STconn.Open(); //根据用户名和密码创建sql语句 string STstrsql = "select * from STUser where STNickName = '"+STUserNickName + "' and STUserPwd = '"+ STUserPwd+"'"; //创建SqlCommand对象,对sql语句进行操作 SqlCommand STcmd = new SqlCommand(STstrsql,STconn); //通过调用ExecuteReader()从数据库中检索行,创建SqlDataReader实例 SqlDataReader STsdr = STcmd.ExecuteReader(); //判断是否有数据 if(STsdr.Read()) { //将获得的STNickName保存到Session中 Session["STNickName"] = STsdr["STNickName"]; //将获得的STNoAdmin保存到Session中 Session["STNoAdmin"] = STsdr["STNoAdmin"]; //判断管理权限 if(Session["STNoAdmin"].ToString()=="0") { //如果是一般用户就定向到STUserLogin.aspx页面 Response.Redirect("STUser\\STUserLogin.aspx"); } else if(Session["STNoAdmin"].ToString() == "1") { //如果是管理员就定向到STManagerLogin.aspx页面 Response.Redirect("STManager\\STManagerLogin.aspx"); } } else { //用户名密码不正确就返回到Index.aspx页面 Response.Write(""); // Response.Redirect("Index.aspx"); } } //当用户输入完用户名和密码后点击重填按钮,就会出发此事件的执行 protected void STReset_Click(object sender, System.EventArgs e) { //定向到Index.aspx页面 Response.Redirect("Index.aspx"); } } }
【文件预览】:
第2章连锁中心配送系统
----源代码()
--------STcontract()
--------说明.txt(55B)
----数据库()
--------DataBase()

网友评论