コード例 #1
0
        private void logInBtn_Click(object sender, EventArgs e)
        {
            ob = cmd.GetUserName(userName);
            if (ob.UserName == userName && ob.Password == password)
            {
                ActionForm af = new ActionForm();
                af.Show();
                this.Hide();
            }
            else
                MessageBox.Show("Invalid UserName and Password ");

        }
コード例 #2
0
 LogInInfo GetData(SqlCommand cmd)
 {
     cmd.Connection.Open();
     SqlDataReader reader = cmd.ExecuteReader();
     LogInInfo ob = new LogInInfo();
     using (reader)
     {
         while (reader.Read())
         {
             ob.Id = reader.GetInt32(0);
             ob.UserName = reader.GetString(1);
             ob.Password = reader.GetString(2);
         }
         reader.Close();
     }
     cmd.Connection.Close();
     return ob;
 }