Esempio n. 1
0
        public void updatepage(string id, pages pg)
        {
            MySqlConnection Connect = new MySqlConnection(ConnectionString);

            Connect.Open();
            string query = "update pages SET pagetitle = '{0}', pagebody = '{1}',pageauthor = '{2}' where pageid = {3};";

            query = string.Format(query, pg.Getpagetitle(), pg.Getpagebody(), pg.Getpageauthor(), id);
            //MySqlConnection Connect = new MySqlConnection(ConnectionString);
            MySqlCommand cmd = new MySqlCommand(query, Connect);

            cmd.ExecuteNonQuery();
        }
Esempio n. 2
0
        public void addpage(pages pg)
        {
            MySqlConnection Connect = new MySqlConnection(ConnectionString);

            Connect.Open();

            string query = "insert into pages(pagetitle,pagebody,pagedate,pageauthor,pagestatus) values('{0}','{1}',now(),'{2}','Published')";

            query = string.Format(query, pg.Getpagetitle(), pg.Getpagebody(), pg.Getpageauthor());
            MySqlCommand cmd = new MySqlCommand();

            cmd = new MySqlCommand(query, Connect);
            cmd.ExecuteNonQuery();
        }