protected void ShowPageInfo(PageDB db) { Debug.WriteLine("i am trying to show the page"); bool valid = true; string pageid = Request.QueryString["pageid"]; if (String.IsNullOrEmpty(pageid)) { valid = false; } Debug.WriteLine("the page validitiy is " + valid + " and the page id is " + pageid); if (valid) { Page_Class page_record = db.FindPage(Int32.Parse(pageid)); page_header_title.InnerHtml += page_record.GetTitle(); page_title.InnerHtml += page_record.GetTitle(); page_body.InnerHtml += page_record.GetBody(); author_number.InnerHtml += page_record.GetAuthorNumber(); created_date.InnerHtml += page_record.GetCreatedDate().ToString("yyyy/mm/dd"); } if (!valid) { } }
public void UpdatePage(int pageid, Page_Class new_page) { string query = "update HTTP_PAGE set TITLE='{0}', BODY='{1}',AUTHOR_ID='{2}' WHERE PAGE_ID='{3}' "; query = String.Format(query, new_page.GetTitle(), new_page.GetBody(), new_page.GetAuthorNumber(), pageid); MySqlConnection Connect = new MySqlConnection(ConnectionString); MySqlCommand cmd = new MySqlCommand(query, Connect); try { Connect.Open(); cmd.ExecuteNonQuery(); Debug.WriteLine("Excueted query " + query); } catch (Exception ex) { Debug.WriteLine("something went wrong in update method"); Debug.WriteLine(ex.ToString()); } Connect.Close(); }
//this is function for show the information in our filed so that they can update it/ protected void ShowPageInfo(PageDB db) { bool valid = true; string pageid = Request.QueryString["pageid"]; if (String.IsNullOrEmpty(pageid)) { valid = false; } if (valid) { Page_Class page_record = db.FindPage(Int32.Parse(pageid)); page_title.InnerHtml += page_record.GetTitle(); pageTitle.Text += page_record.GetTitle(); page_body.Text += page_record.GetBody(); author_number.Text += page_record.GetAuthorNumber(); } if (!valid) { Debug.WriteLine("may b check here" + pageid); } }
public void AddPage(Page_Class new_http_page) { string query = "insert into HTTP_PAGE(TITLE,BODY,AUTHOR_ID,CREATED_DATE) VALUES ('{0}','{1}','{2}','{3}')"; //UPPER STRING FOR QUERY AND VALUES IN CURLY BRACES TO REFER THESE VALUES; query = String.Format(query, new_http_page.GetTitle(), new_http_page.GetBody(), new_http_page.GetAuthorNumber(), new_http_page.GetCreatedDate().ToString("yyyy/mm/dd")); //now for sql connection MySqlConnection Connect = new MySqlConnection(ConnectionString); MySqlCommand cmd = new MySqlCommand(query, Connect); try { Connect.Open(); cmd.ExecuteNonQuery(); //here excute non query for creating updating and delete //other then this we are using excute reder for read the things } catch (Exception ex) { Debug.WriteLine("something is wrong here"); Debug.WriteLine(ex.ToString()); } Connect.Close(); }