예제 #1
0
        protected void ImageButtonAdd_Click(object sender, ImageClickEventArgs e)
        {
            SqlConnection sqlConn = new SqlConnection(ConfigurationManager.ConnectionStrings["AppConnectionString"].ConnectionString);
            SqlCommand    sqlCmd  = new SqlCommand("sp_adminStatsAdd", sqlConn);

            sqlCmd.CommandType = CommandType.StoredProcedure;

            //try
            //{
            sqlConn.Open();
            sqlCmd.ExecuteNonQuery();
            //}
            //catch (Exception ex)
            //{

            //}
            //finally
            //{
            sqlConn.Close();
            sqlCmd.Dispose();
            sqlConn.Dispose();
            //}

            DropDownListStats.DataBind();
        }
예제 #2
0
        protected void ImageButtonDelete_Click(object sender, ImageClickEventArgs e)
        {
            SqlConnection sqlConn = new SqlConnection(ConfigurationManager.ConnectionStrings["AppConnectionString"].ConnectionString);
            SqlCommand    sqlCmd  = new SqlCommand("sp_adminStatsDelete", sqlConn);

            //try
            //{
            sqlCmd.CommandType = CommandType.StoredProcedure;
            sqlCmd.Parameters.Add("@StatisticId", SqlDbType.Int).Value = Convert.ToInt32(DropDownListStats.SelectedValue);

            sqlConn.Open();
            sqlCmd.ExecuteNonQuery();

            DropDownListStats.DataBind();
            PanelStats.Visible = false;
            //}
            //catch (Exception ex)
            //{

            //}
            //finally
            //{
            sqlConn.Close();
            sqlCmd.Dispose();
            sqlConn.Dispose();
            //}
        }