protected void BtnUpdate_Click(object sender, EventArgs e) { try { if (FileUpload1.HasFile) { string nam = Path.GetFileName(FileUpload1.FileName); if (File.Exists(Server.MapPath("~/images/" + nam))) { lbl_Message.Text = "File Alredy Exist"; } else { if (txtHeading.Text == "" || txtParagraph.Text == "") { lbl_Message.Text = "Plz Fill TextBoxes !!"; } else { qry = "select * from tbl_Home where id = 1"; File.Delete(Server.MapPath("~/" + obj.FindField(qry, "Background_Img"))); FileUpload1.SaveAs(Server.MapPath("~/images/" + nam)); nam = "/images/" + nam; qry = "Update tbl_Home set Heading='" + txtHeading.Text + "' , Paragraph='" + txtParagraph.Text + "' , Background_Img = '" + nam + "' where id=1"; obj.Manipulate(qry); lbl_Message.Text = "Updation With Image Successfully"; } } } else { qry = "Update tbl_Home set Heading='" + txtHeading.Text + "' , Paragraph='" + txtParagraph.Text + "' where id=1"; obj.Manipulate(qry); lbl_Message.Text = "Updation WithOut Image Successfully"; } } catch (Exception ex) { lbl_Message.Text = "Error !! " + ex; } }
protected void btnUpdate_Headings_Click(object sender, EventArgs e) { try { qry = "Update tbl_AboutUs set V1_H1 = '" + txtHeading_1.Text + "' , V1_H2 = '" + txtHeading_2.Text + "' , V2_H1 = '" + txtHeading_3.Text + "' where id = 1"; bool chk = obj.Manipulate(qry); if (chk == true) { lbl_Message_1.Text = "!! Headings Updated Successfully !!"; } else { lbl_Message_1.Text = "!! Updation Failed !!"; } } catch (Exception) { lbl_Message_1.Text = "!! Error !!"; } }
protected void btn_Update_Click(object sender, EventArgs e) { if (!IsPostBack) { qry = "Update tbl_Classes set H1 = ('" + TxtHeading_1.Text.ToString().ToLower() + "') , H2 = ('" + TxtHeading_2.Text.ToString().ToLower() + "') , H3 = ('" + TxtHeading_3.Text.ToString().ToLower() + "' ), H4 = ('" + TxtHeading_4.Text.ToString().ToLower() + "' ), P1 = ('" + TxtPara_1.Text.ToString().ToLower() + "' ), P2 = ('" + TxtPara_2.Text.ToString().ToLower() + "' ), P3 = ('" + TxtPara_3.Text.ToString().ToLower() + "' ), P4 = ('" + TxtPara_4.Text.ToString().ToLower() + "' ) where id = '1'"; bool chk = obj.Manipulate(qry); if (chk == true) { lbl_Messaage.Text = "!! Record Updated Successfully !!"; } else { lbl_Messaage.Text = "!! Record Updation Failed !!"; } } }