using System; using System.Collections; using System.Configuration; using System.Data; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.HtmlControls; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Data.SqlClient; public partial class Title_Add : System.Web.UI.Page { SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["CMSConnectionString"].ToString()); protected void Page_Load(object sender, EventArgs e) { } protected void btnAdd2_Click(object sender, EventArgs e) { AddRecord(); } private void AddRecord() { string xadmin = Session["AddNew"].ToString(); if (xadmin == "True") { try { if (txtYear.Text == "") { txtYear.Text = "1435"; } if (txtTitle.Text == "") { return; txtTitle.Focus(); lblerror2.Text = "يجب ادخال العنوان"; } // = , == " + SqlCommand cmdInsert = new SqlCommand("insert into tbl_Title(Tit_Book,Tit_Matwya,Tit_Article,Tit_Card,Tit_Video" + " ,Tit_Da,Tit_Dalil,Tit_Flash,Tit_other,Le_Title,Le_Day,Le_Month,Le_Year,Le_User)" + " Values(" + txtTit_Book.Text + "," + txtTit_Matwya.Text + "," + txtTit_Article.Text + "," + " " + txtTit_Card.Text + "," + txtTit_Video.Text + "," + txtTit_Da.Text + "," + txtTit_Dalil.Text + "," + "" + txtTit_Flash.Text + "," + txtTit_other.Text + ",N'" + txtTitle.Text + "',"+ "N'" + DrpDay.SelectedValue + "',N'" + DrpMonth.SelectedValue + "'," + "N'" + txtYear.Text + "'," + Session["User"].ToString() + ")", con); if (con.State == ConnectionState.Closed) con.Open(); cmdInsert.ExecuteNonQuery(); con.Close(); lblerror2.Text = "تم إضافة البيان الجديد"; txtYear.Text = ""; DrpMonth.ClearSelection(); DrpDay.ClearSelection(); txtTit_Article.Text = ""; txtTit_Book.Text = ""; txtTit_Card.Text = ""; txtTit_Da.Text = ""; txtTit_Dalil.Text = ""; txtTit_Flash.Text = ""; txtTit_Matwya.Text = ""; txtTit_other.Text = ""; txtTit_Video.Text = ""; txtTitle.Text = ""; } catch (Exception ex) { lblerror2.Text = "حدث خطأ كالتالي " + ex.ToString(); return; } } else lblerror2.Text="ليس لك الصلاحية في هذا الاجراء"; } protected void btnreturn_Click(object sender, EventArgs e) { Response.Redirect("Title.aspx"); } }