Пример #1
0
        protected void Insert(object sender, EventArgs e)
        {
            CRUD_SPClient client = new CRUD_SPClient();

            var abc = client.DoWork().ToList();

            client.Close();
            string name    = txtName.Text;
            string country = txtCountry.Text;

            //string constr = ConfigurationManager.ConnectionStrings["constr"].ConnectionString;
            //using (SqlConnection con = new SqlConnection(constr))
            //{
            //    using (SqlCommand cmd = new SqlCommand("Resources_CRUD"))
            //    {
            //        cmd.CommandType = CommandType.StoredProcedure;
            //        cmd.Parameters.AddWithValue("@Action", "INSERT");
            //        cmd.Parameters.AddWithValue("@Name", name);
            //        cmd.Parameters.AddWithValue("@Country", country);
            //        cmd.Connection = con;
            //        con.Open();
            //        cmd.ExecuteNonQuery();
            //        con.Close();
            //    }
            //}

            client = new CRUD_SPClient();

            if (client.Insert(name, country))
            {
                this.BindGrid(client.DoWork().ToList());
            }

            client.Close();
        }