基本信息
源码名称:适合C#入门,一个简单的公司物料管理系统
源码大小:0.10M
文件格式:.rar
开发语言:C#
更新时间:2015-01-29
   友情提示:(无需注册或充值,赞助后即可获取资源下载链接)

     嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):813200300

本次赞助数额为: 2 元 
   源码介绍

适合C#入门,一个简单的公司物料管理系统


  private void connection(string loginName,string password)
        {
            if (txtLoginName.Text != "")
            {
                OleDbConnection conn = null;
                try
                {
                    conn = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=.\\sysManage.mdb");
                    conn.Open();
                    string selSql = "select * from login where loginName='" loginName "'";
                    OleDbCommand cmd = new OleDbCommand(selSql, conn);
                    OleDbDataReader reader = cmd.ExecuteReader();
                    if (!reader.HasRows)
                    {
                        MessageBox.Show("用户名错误,请重新输入!", "错误提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        this.clearText();
                        this.txtLoginName.Focus();
                    }
                    else
                    {
                        while (reader.Read())
                        {
                            if (password != reader.GetString(2))
                            {
                                MessageBox.Show("密码错误!", "登陆提示", MessageBoxButtons.OK, MessageBoxIcon.Error);
                            }
                            else
                            {
                                // MessageBox.Show("登陆成功!","登陆提示",MessageBoxButtons.OK,MessageBoxIcon.Information);
                                frmMain main = new frmMain();
                                main.Show();
                                this.Hide();
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show("打开连接时出现错误!");
                }
                finally
                {
                    if (conn != null)
                        conn.Close();
                }
            }
            else
            {
                MessageBox.Show("请填写登陆名!","登陆提示",MessageBoxButtons.OK,MessageBoxIcon.Information);
            }
        }