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 re_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"; } // = , == " + SqlCommand cmdInsert = new SqlCommand("insert into tbl_re(Tit_No1,Tit_No2,Tit_No3,Tit_No4,Tit_No5,Tit_No6,Tit_No7" + " ,Le_Day,Le_Month,Le_Year,Le_User)" + " Values(" + txtTit_No1.Text + "," + txtTit_No2.Text + "," + txtTit_No3.Text + "," + " " + txtTit_No4.Text + "," + txtTit_No5.Text + "," + txtTit_No6.Text + "," + txtTit_No7.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_No1.Text = "0"; txtTit_No2.Text = "0"; txtTit_No3.Text = "0"; txtTit_No4.Text = "0"; txtTit_No5.Text = "0"; txtTit_No6.Text = "0"; txtTit_No7.Text = "0"; } catch (Exception ex) { lblerror2.Text = "حدث خطأ كالتالي " + ex.ToString(); return; } } else lblerror2.Text="ليس لك الصلاحية في هذا الاجراء"; } protected void btnreturn_Click(object sender, EventArgs e) { Response.Redirect("re.aspx"); } }