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 FreeCopy_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 = "1436"; } // = , == " + SqlCommand cmdInsert = new SqlCommand("insert into tbl_FreeCopy(Tit_Book,Tit_Matwya,Tit_CD,Tit_Card,Tit_Bag" + " ,Le_Day,Le_Month,Le_Year,Le_User)" + " Values(" + txtTit_Book.Text + "," + txtTit_Matwya.Text + "," + txtTit_CD.Text + "," + " " + txtTit_Card.Text + "," + txtTit_Bag.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_Bag.Text = "0"; txtTit_Book.Text = "0"; txtTit_Card.Text = "0"; txtTit_CD.Text = "0"; txtTit_Matwya.Text = "0"; } catch (Exception ex) { lblerror2.Text = "حدث خطأ كالتالي " + ex.ToString(); return; } } else lblerror2.Text="ليس لك الصلاحية في هذا الاجراء"; } protected void btnreturn_Click(object sender, EventArgs e) { Response.Redirect("FreeCopy.aspx"); } }