Login.cs
#1

Login.cs

Code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.OleDb;  

namespace SchoolManagementSystem
{
    public partial class LoginForm : Form
    {

        OleDbConnection cn = new OleDbConnection(ConnectionStringForSMS.MyConnectionString());
        public LoginForm()
        {
            InitializeComponent();
        }

        private void button2_Click(object sender, EventArgs e)
        {
            textpassword.Text = "";
            textusername.Text = "";
            textusername.Focus();
        }

        private void buttonlogin_Click(object sender, EventArgs e)
        {
            if (textusername.Text.Trim() == "")
            {
                MessageBox.Show("Please Enter Username", "School Management System", MessageBoxButtons.OK, MessageBoxIcon.Information   );
                textusername.Focus();
            }
            else if (textpassword.Text.Trim() == "")
            {
                MessageBox.Show("Please Enter Password", "School Management System", MessageBoxButtons.OK, MessageBoxIcon.Information);
                textpassword.Focus();
            }
            else
            {
                try
                {
                    OleDbDataAdapter da = new OleDbDataAdapter("select username,password from login where username='" + textusername.Text.Replace("'", "") + "'and password='" + textpassword.Text.Replace("'", "") + "' ", cn);
                    DataSet ds = new DataSet();
                    da.Fill(ds);
                    if (ds.Tables[0].Rows.Count > 0)
                    {

                        this.Hide();
                        
                        SMSMainForm obj = new SMSMainForm();
                        obj.Show();

                    }
                    else
                    {
                        MessageBox.Show("Login Failed!Check UserName and Password? ", "School Management System", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        textusername.Focus();
                    }
                }

                catch(Exception ex)
                {
                    MessageBox.Show(ex.Message.ToString(), "School Management System", MessageBoxButtons.OK, MessageBoxIcon.Information);
    
                }
            }
        }

        private void button1_Click(object sender, EventArgs e)
        {
            Application.Exit();  
        }
        private void LoginForm_Load(object sender, EventArgs e)
        {
            textusername.Focus();
            OleDbDataAdapter da23 = new OleDbDataAdapter("select schooltitle,Address from schooltitle", cn);
            DataSet ds23 = new DataSet();
            da23.Fill(ds23);
            string schooltitle = ds23.Tables[0].Rows[0].ItemArray[0].ToString();
            string address = ds23.Tables[0].Rows[0].ItemArray[1].ToString();
            this.Text = schooltitle + "-Login";


            label1.Text = "";
            label1.Text = schooltitle;
        }

        private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            frmcreateuser nuser = new frmcreateuser();
            nuser.Show();
        }

        private void linkLabel2_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            ChangePwd chgpwd = new ChangePwd();
            chgpwd.Show();
        }


      
    }
}
Reply

Important Note..!

If you are not satisfied with above reply ,..Please

ASK HERE

So that we will collect data for you and will made reply to the request....OR try below "QUICK REPLY" box to add a reply to this page
Popular Searches: university of waterloo quest login, http students portal2learn com login, totobet login result hk 30 01 2013, fadduengineers login, hdfclife cc login, smart class teachers login, employee login logout project** education,

[-]
Quick Reply
Message
Type your reply to this message here.

Image Verification
Please enter the text contained within the image into the text box below it. This process is used to prevent automated spam bots.
Image Verification
(case insensitive)

Forum Jump: