目前,我们有一个解决方案,使用此方法从URL中获取文件名
currentFile = Path.GetFileNameWithoutExtension(url);
Run Code Online (Sandbox Code Playgroud)
我们发现,如果附加的查询字符串包含引号等字符,则返回时路径中出现非法字符错误.
例如,如果网址是
http:\\myurl.com\mypage.aspx?utm_content=This+Is+"Broken"
Run Code Online (Sandbox Code Playgroud)
然后它将无法获取文件名.获得"mypage"有更好,更清洁的方法吗?
我是LINQ的新手,迫切需要快速完成这个项目.我需要使用每个MPrice的今天日期的正确价格信息返回id.任何建议都非常感谢!以下是XML的示例:
<Pricing>
<MPrice>
<Id>0079</Id>
<Price>
<Price>31.25</Price>
<StartDt>2009-8-01</StartDt>
<EndDt>2009-08-26</EndDt>
</Price>
<Price>
<ListPrice>131.25</ListPrice>
<StartDt>2009-08-26</StartDt>
<EndDt>9999-12-31</EndDt>
</Price>
</MPrice>
<MPrice>
<Id>0081</Id>
<Price>
<Price>131.25</Price>
<StartDt>2009-8-01</StartDt>
<EndDt>2009-08-26</EndDt>
</Price>
<Price>
<ListPrice>231.25</ListPrice>
<StartDt>2009-08-26</StartDt>
<EndDt>9999-12-31</EndDt>
</Price>
</MPrice>
</Pricing>
Run Code Online (Sandbox Code Playgroud) 目前我正在试图弄清楚如何将动态查询字符串参数添加到我的站点地图导航菜单.例如,用户选择他想要使用的源和版本.我有一个简单的站点地图,可以创建导航链接,但用户选择的参数需要在查询字符串中传递.默认地图如下所示:
<siteMapNode url="" title="" description="" >
<siteMapNode url="~/Image.aspx?location=Our Products" title="Our Products" description="Our Products" />
<siteMapNode url="~/Headline.aspx?location=Our Authors" title="Our Authors" description="Our Authors" />
</siteMapNode>
Run Code Online (Sandbox Code Playgroud)
现在,链接需要根据用户选择的内容动态添加参数.例如:
<siteMapNode url="~/Image.aspx?location=Our Products&Source=12345&Edition=asdfff" title="Our Products" description="Our Products" />
<siteMapNode url="~/Headline.aspx?location=Our Authors&Source=12345&Edition=asdfff" title="Our Authors" description="Our Authors" />
Run Code Online (Sandbox Code Playgroud)
希望这是相当清楚的.如果有人需要更深入的解释,请告诉我.
谢谢
我正在更新多个表中的数据。目前我有一个表,其中有一个字段“sources”,它只是包含字段“itemid”的所有表的列表。我还有一个包含 2 个字段的表,“itemid”和“olditemid”。在 TSQL 中,我想迭代源并动态创建更新语句。这是我试图做的,但我在更新语句中收到一些错误,表明我的变量未声明。我不确定这是否接近我应该这样做的正确方式。有想法吗?
DECLARE @tblName varchar(50)
DECLARE process_cursor CURSOR FOR
SELECT source
FROM tmpTableNames
OPEN process_cursor
FETCH NEXT FROM processcursor
INTO @tblName
WHILE @@FETCH_STATUS = 0
UPDATE @tblName
SET itemid = r.itemid
FROM @tblName v, itemref r
WHERE r.olditemid = v.itemid
FETCH NEXT FROM process_cursor
INTO @tblName
END
CLOSE processcursor
DEALLOCATE processcursor
Run Code Online (Sandbox Code Playgroud)