예제 #1
0
        public bool Delete(MonAdClass c)
        {
            bool isSuccess = false;

            SqlConnection conn = new SqlConnection(myconnstrng);

            try
            {
                string sql = "DELETE FROM tbl_info WHERE Memberid=@Memberid";

                SqlCommand cmd = new SqlCommand(sql, conn);
                cmd.Parameters.AddWithValue("@Memberid", c.Memberid);

                conn.Open();
                int rows = cmd.ExecuteNonQuery();

                if (rows > 0)
                {
                    isSuccess = true;
                }
                else
                {
                    isSuccess = false;
                }
            }
            catch (Exception ex)
            {
            }
            finally
            {
                conn.Close();
            }
            return(isSuccess);
        }
예제 #2
0
        public bool Insert(MonAdClass c)
        {
            bool isSuccess = false;

            SqlConnection conn = new SqlConnection(myconnstrng);

            try
            {
                string sql = "INSERT INTO tbl_info (Memberid, Firstname, Lastname, Contactno, Gender, Age, Category, Civilstatus, Address) VALUES (@Memberid, @Firstname, @Lastname, @Contactno, @Gender, @Age, @Category, @Civilstatus, @Address)";

                SqlCommand cmd = new SqlCommand(sql, conn);
                cmd.Parameters.AddWithValue("@Memberid", c.Memberid);
                cmd.Parameters.AddWithValue("@Firstname", c.Firstname);
                cmd.Parameters.AddWithValue("@Lastname", c.Lastname);
                cmd.Parameters.AddWithValue("@Contactno", c.Contactno);
                cmd.Parameters.AddWithValue("@Gender", c.Gender);
                cmd.Parameters.AddWithValue("@Age", c.Age);
                cmd.Parameters.AddWithValue("@Category", c.Category);
                cmd.Parameters.AddWithValue("@Civilstatus", c.Civilstatus);
                cmd.Parameters.AddWithValue("@Address", c.Address);


                conn.Open();
                int rows = cmd.ExecuteNonQuery();

                if (rows > 0)
                {
                    isSuccess = true;
                }
                else
                {
                    isSuccess = false;
                }
            }
            catch (Exception ex)
            {
            }
            finally
            {
            }
            return(isSuccess);
        }
예제 #3
0
        public bool Update(MonAdClass c)
        {
            bool          isSuccess = false;
            SqlConnection conn      = new SqlConnection(myconnstrng);

            try
            {
                string sql = "UPDATE tbl_info SET Firstname=@Firstname, Lastname=@Lastname, Contactno=@Contactno, Age=@Age, Address=@Address, Gender=@Gender, Category=@Category, Civilstatus=@Civilstatus, Status=@Status, Attendance=@Attendance WHERE Memberid=@Memberid";

                SqlCommand cmd = new SqlCommand(sql, conn);

                cmd.Parameters.AddWithValue("@Memberid", c.Memberid);
                cmd.Parameters.AddWithValue("@Firstname", c.Firstname);
                cmd.Parameters.AddWithValue("@Lastname", c.Lastname);
                cmd.Parameters.AddWithValue("@Contactno", c.Contactno);
                cmd.Parameters.AddWithValue("@Age", c.Age);
                cmd.Parameters.AddWithValue("@Address", c.Address);
                cmd.Parameters.AddWithValue("@Gender", c.Gender);
                cmd.Parameters.AddWithValue("@Category", c.Category);
                cmd.Parameters.AddWithValue("@Civilstatus", c.Civilstatus);

                conn.Open();

                int rows = cmd.ExecuteNonQuery();
                if (rows > 0)
                {
                    isSuccess = true;
                }
                else
                {
                    isSuccess = false;
                }
            }
            catch (Exception ex)
            {
            }
            finally
            {
                conn.Close();
            }
            return(isSuccess);
        }