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

            SqlConnection conn = new SqlConnection(myconnstrng);

            try
            {
                string sql = "DELETE FROM tbl_Eventinfo WHERE Entryno=@Entryno";

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

                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 Update(EventsClass c)
        {
            bool          isSuccess = false;
            SqlConnection conn      = new SqlConnection(myconnstrng);

            try
            {
                string sql = "UPDATE tbl_Eventinfo SET Announcement=@Announcement, Programs=@Programs, Calendar_Of_Activities=@Calendar_Of_Activities WHERE Entryno=@Entryno";

                SqlCommand cmd = new SqlCommand(sql, conn);

                cmd.Parameters.AddWithValue("@Announcement", c.Announcement);
                cmd.Parameters.AddWithValue("@Programs", c.Programs);
                cmd.Parameters.AddWithValue("@Calendar_Of_Activities", c.Calendar_Of_Activities);
                cmd.Parameters.AddWithValue("Entryno", c.Entryno);
                conn.Open();

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

            SqlConnection conn = new SqlConnection(myconnstrng);

            try
            {
                string sql = "INSERT INTO tbl_Eventinfo (Announcement, Programs, Calendar_Of_Activities) VALUES (@Announcement, @Programs, @Calendar_Of_Activities)";

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

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

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