コード例 #1
0
 private void btnlogin_Click(object sender, EventArgs e)
 {
     conn = new SqlConnection(@"Data Source=(LocalDB)\v11.0;AttachDbFilename=C:\MY COURSES-4\PROG37721\Final-Project\studentfeemanagmentsystem\Students.mdf;Integrated Security=True");
     try
     {
         string query = "Select * From login WHERE username=@user AND password=@pass";
         conn.Open();
         cmd = new SqlCommand(query, conn);
         cmd.Parameters.AddWithValue("@user", loginusr.Text.ToString());
         cmd.Parameters.AddWithValue("@pass", loginpass.Text.ToString());
         da = new SqlDataAdapter(cmd);
         DataSet ds = new DataSet();
         da.Fill(ds);
         SqlDataReader sdr = cmd.ExecuteReader();
         //  If the record can be queried, it means passing verification, then open another form.
         if ((sdr.Read() == true))
         {
             MessageBox.Show("The user is valid!");
             this.Hide();
             welcome obj10 = new welcome();
             obj10.ShowDialog();
         }
         else
         {
             MessageBox.Show("Username or Password is not correct !");
         }
     }
     catch (Exception ex)
     {
         ex.ToString();
         MessageBox.Show("Username not found");
     }
 }
コード例 #2
0
ファイル: Login.cs プロジェクト: shas0408/SMS
        private void button1_Click(object sender, EventArgs e)
        {
            FileStream   filestream = new FileStream("login.txt", FileMode.Open, FileAccess.Read);
            StreamReader reader     = new StreamReader(filestream);
            string       filereader = File.ReadAllText("login.txt");
            int          i          = 0;

            while ((filereader = reader.ReadLine()) != null)
            {
                if (filereader.Contains(textBox1.Text) && filereader.Contains(textBox2.Text))
                {
                    i++;
                    welcome obj10 = new welcome();
                    obj10.ShowDialog();
                }

                // else if (filereader.Contains(textBox1.Text) != filereader.Contains(textBox2.Text))
                //{

                //       MessageBox.Show("You are Not Register");

                // }
            }
        }
コード例 #3
0
ファイル: update.cs プロジェクト: shas0408/SMS
        private void button1_Click(object sender, EventArgs e)
        {
            welcome obj7 = new welcome();

            obj7.ShowDialog();
        }
コード例 #4
0
        private void homeToolStripMenuItem_Click(object sender, EventArgs e)
        {
            welcome obj11 = new welcome();

            obj11.ShowDialog();
        }