Click here to Skip to main content
16,017,502 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
namespace SalesAndMonitoring
{
    public partial class frmLogin : Form
    {
        private string User = "";
        private bool isvalid = false;
        private string[] privileges;

        public string[] Privileges
        {
            get { return privileges; }
        }

        public string getUser
        {
            get { return User; }
        }

        public bool isValid
        {
            get { return isvalid; }
        }

       
        private void sValidate()
        {
            var user =
                BusinessAccessLayer.GetEntity().User_tbl.Where(
                    e => e.UserID == txtUsername.Text && e.Password == txtPassword.Text);


            if(user.Count() >0)
            {
                isvalid = true;
                User = txtUsername.Text;
                Close();
                return;
            }

            MessageBox.Show("Invalid username or password", "invalid", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }

      
        public frmLogin()
        {
            InitializeComponent();
            txtUsername.Focus();
        }

        private void btnCancel_Click(object sender, EventArgs e)
        {
            DialogResult rs = MessageBox.Show("Are you sure you want to exit?", "Exit", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
            if (rs == DialogResult.No) { return; }
            Application.Exit();
        }
Posted
Updated 22-Oct-12 5:03am
v2

1 solution

The database connection isn't connected correctly. The database connection is postponed until you actually request data from it, that's why the error about it is a little late.

Good luck!
 
Share this answer
 
Comments
zeshanazam 23-Oct-12 6:27am    
Database connection is connected successfully, but there is still same error... :(

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900