// 执行非查询sql语句,并返回受影响的行数
        public static int ExecuteNonQuery(string sql, params SqlParameter[] sqlparams)
        {
            using (SqlConnection conn = new SqlConnection(ConStr))
            {
                conn.Open();
                using (SqlCommand cmd = new SqlCommand(sql, conn))
                {
                    foreach (SqlParameter sqlparam in sqlparams)
                    {
                        cmd.Parameters.Add(sqlparam);
                    }
                    return cmd.ExecuteNonQuery();
                }
            }
        }