protected void ShowPageInfo(htmldb db) { bool valid = true; string html_id = Request.QueryString["html_id"]; if (String.IsNullOrEmpty(html_id)) { valid = false; } if (valid) { HTTP_Page page_record = db.Find_Page(Int32.Parse(html_id)); html_tag_title.InnerHtml = page_record.GetPageTitle(); html_tag_desc.InnerHtml = page_record.GetPageBody(); } else { valid = false; } if (!valid) { html_element.InnerHtml = "There is an error finding a page."; } }
public void Add_Page(HTTP_Page new_page) { string query = "insert into html (html_tags_title, html_tags_body) values ('{0}','{1}')"; query = String.Format(query, new_page.GetPageTitle(), new_page.GetPageBody()); MySqlConnection Connect = new MySqlConnection(ConnectionString); MySqlCommand cmd = new MySqlCommand(query, Connect); try { Connect.Open(); cmd.ExecuteNonQuery(); } catch (Exception ex) { Debug.WriteLine("Something went wrong in the Add_Page Method!"); Debug.WriteLine(ex.ToString()); } Connect.Close(); }
protected void ShowPageInfo(htmldb db) { bool valid = true; string html_id = Request.QueryString["html_id"]; if (String.IsNullOrEmpty(html_id)) { valid = false; } if (valid) { HTTP_Page page_record = db.Find_Page(Int32.Parse(html_id)); html_tag.Text = page_record.GetPageTitle(); html_body.Text = page_record.GetPageBody(); } if (!valid) { update_element.InnerHtml = html_id; } }
public void UpdatePage(int html_id, HTTP_Page new_page) { string query = "update html set html_tags_title='{0}', html_tags_body='{1}' where html_tags_id={2}"; query = String.Format(query, new_page.GetPageTitle(), new_page.GetPageBody(), html_id); MySqlConnection Connect = new MySqlConnection(ConnectionString); MySqlCommand cmd = new MySqlCommand(query, Connect); try { Connect.Open(); cmd.ExecuteNonQuery(); Debug.WriteLine("Executed query " + query); } catch (Exception ex) { Debug.WriteLine("Something went wrong in the Update_Page Method!"); Debug.WriteLine(ex.ToString()); } Connect.Close(); }