我有一个存储过程,如下所示:
CREATE PROCEDURE dbo.usp_TestFilter
@AdditionalFilter BIT = 1
AS
SELECT *
FROM dbo.SomeTable T
WHERE
T.Column1 IS NOT NULL
AND CASE WHEN @AdditionalFilter = 1 THEN
T.Column2 IS NOT NULL
Run Code Online (Sandbox Code Playgroud)
不用说,这不起作用.如何激活检查@AdditionalFilter参数的附加where子句?谢谢你的帮助.
我正在尝试为MOSS设置故障转移位置.当前服务器场是基于32位Windows 2003构建的.服务器和故障转移位置都是64位Windows 2008.
有没有办法让这两个环境保持同步?我考虑过一个"拉伸"的农场配置,但是这两个位置的位宽都不相同.
MOSS的当前数据库服务器使用群集复制到我们的故障转移位置,并且在两个位置都可见.
有什么方法可以用测试凭证模拟FormsAuthentication.Authenticate("用户名","密码")方法吗?我的测试目标是确保如果身份验证失败,它会重定向到正确的位置.我正在使用Rhino Mocks作为模拟框架.
非常感谢您的帮助,
我有一个文档库的自定义定义,我试图只使用开箱即用的Web服务重命名库中的文档.定义了一个带有"Name"字段的视图并尝试"LinkFilename"后,我重命名文件的调用分别返回失败或忽略新值.
如何使用SharePoint Web服务重命名文件?
SPDisposeCheck实用程序提醒我一个不正确处理的SPWeb.Add调用.正如您在下面所看到的,典型的使用(SPWeb NewWeb = webs.add(siteUrl ....)方法不起作用,因为RunWithElevatedPrivileges会使返回newWeb脱离上下文.
通过查看下面的newWeb = webs.Add()行,是否有人可以建议一种方法来正确处理新的SPWeb对象?提前致谢.
public partial class SiteHelper
{
public static SPWeb CreateSiteFromSTP(SPWeb parentWeb, string newSiteSTP, int teamId)
{
try
{
SPWeb newWeb = null;
SPSecurity.RunWithElevatedPrivileges(delegate()
{
string siteUrl = teamId.ToString();
SPWebCollection webs = parentWeb.Webs;
newWeb = webs.Add(siteUrl,.,.,.,);
TraceProvider.WriteLine("Activating Feature : MembersFeature ");
newWeb.Features.Add(new Guid(TeamSiteAttributes.MembersFeature), true);
TraceProvider.WriteLine("Activating Feature : BadgeAwardsFeature ");
newWeb.Features.Add(new Guid(TeamSiteAttributes.BadgeAwardsFeature), true);
TraceProvider.WriteLine("Activating Feature : ProjectBenefitsFeature ");
newWeb.Features.Add(new Guid(TeamSiteAttributes.ProjectBenefitsFeature), true);
TraceProvider.WriteLine("Activating Feature : TeamScoreFeature …Run Code Online (Sandbox Code Playgroud) 我需要使用非常适合正则表达式的XSLT 1.0执行查找和替换.不幸的是,这些在1.0中不可用,我也无法使用任何扩展库,如EXSLT,因为我无法更改安全设置.
我正在使用的字符串如下所示:
19;#John Smith;#17;#Ben Reynolds;#1;#Terry Jackson
我需要; #用a 替换数字和字符,.例如,上面将改为:
John Smith, Ben Reynolds, Terry Jackson
我知道需要一个递归字符串函数,可能使用substring和translate,但我不知道从哪里开始.
有没有人对如何解决这个问题有一些指导?这是我开始的:
<xsl:template name="TrimMulti">
<xsl:param name="FullString" />
<xsl:variable name="NormalizedString">
<xsl:value-of select="normalize-space($FullString)" />
</xsl:variable>
<xsl:variable name="Hash">#</xsl:variable>
<xsl:choose>
<xsl:when test="contains($NormalizedString, $Hash)">
<!-- Do something and call TrimMulti -->
</xsl:when>
</xsl:choose>
</xsl:template>
Run Code Online (Sandbox Code Playgroud) 继建议之后,我试图使用List.GetItems(Query)来检索我的初始数据子集,而不是通过List.Items检索整个列表内容.但是,List.Items.Cast()导致Linq可用的IEnumerable,List.GetItems(查询).Cast()不会.
工作守则:
IEnumerable<SPListItem> results = SPContext.Current.Web.Lists[ListName].Items.Cast<SPListItem>().Where(item => item["Date"] != null).Where(item => DateTime.Parse(item["Date"].ToString()) >= StartDate).Where(item => DateTime.Parse(item["Date"].ToString()) <= EndDate);
MessageLine = results.Count().ToString();
Run Code Online (Sandbox Code Playgroud)
非工作代码:
string SPStartDate = SPUtility.CreateISO8601DateTimeFromSystemDateTime(this.StartDate);
string SPEndDate = SPUtility.CreateISO8601DateTimeFromSystemDateTime(this.EndDate);
SPQuery MyQuery = new SPQuery();
MyQuery.Query = "<Where><And><And><Geq><FieldRef Name='Date'/><Value Type='DateTime'>" + SPStartDate + "</Value></Geq><Leq><FieldRef Name='Date'/><Value Type='DateTime'>" + SPEndDate + "</Value></Leq></And></Where>";
IEnumerable<SPListItem> results = SPContext.Current.Web.Lists[ListName].GetItems(MyQuery).Cast<SPListItem>();
MessageLine = results.Count().ToString();
Run Code Online (Sandbox Code Playgroud)
List.GetItems(Query).Cast()方法在.Count()行上产生以下异常:
Microsoft.SharePoint.SPException:无法完成此操作.请再试一次.---> System.Runtime.InteropServices.COMException(0x80004005):无法完成此操作.请再试一次.在Microsoft.SharePoint.Library.SPRequestInternalClass.GetListItemDataWithCallback(字符串bstrUrl,字符串bstrListName,字符串bstrViewName,字符串bstrViewXml,SAFEARRAYFLAGS fSafeArrayFlags,ISP2DSafeArrayWriter pSACallback,ISPDataCallback pPagingCallback,ISPDataCallback pSchemaCallback)在Microsoft.SharePoint.Library.SPRequest.GetListItemDataWithCallback(字符串bstrUrl,字符串bstrListName,字符串bstrViewName,字符串bstrViewXml,SAFEARRAYFLAGS fSafeArrayFlags,ISP2DSafeArrayWriter pSACallback,ISPDataCallback pPagingCallback,ISPDataCallback pSchemaCallback)---内部异常堆栈跟踪的末尾在Microsoft.SharePoint.Library.SPRequest.GetListItemDataWithCallback(字符串bstrUrl,字符串bstrListName,字符串Microsoft.SharePoint.SPListItemCol上的Microsoft.SharePoint.SPListItemCollection.EnsureListItemsData()中的bstrViewName,String bstrViewXml,SAFEARRAYFLAGS fSafeArrayFlags,ISP2DSafeArrayWriter pSACallback,ISPDataCallback pPagingCallback,ISPDataCallback pSchemaCallback)
1.MoveNext() at System.Linq.Enumerable.Count[TSource](IEnumerable在Test.CreateChildControls()的Test.GetTransactionsInPeriod()中的System.Linq.Enumerable.d__aa 1源码处的Microsoft.SharePoint.SPBaseCollection.System.Collections.IEnumerable.GetEnumerator()处的lection.Undirty()
谁能提出任何建议?
大多数时候我使用Visual Studio 2008.右键单击此产品时,会出现一个上下文菜单.
我想看到键盘快捷键绑定到上下文菜单中的每个菜单项.
有谁知道如何显示这些?
我有一个带有以下签名的ASP.NET 2.0 Web方法:
[WebMethod]
public QueryResult[] GetListData(
string url, string list, string query, int noOfItems, string titleField)
Run Code Online (Sandbox Code Playgroud)
我正在运行disco.exe工具从此Web服务生成.wsdl和.disco文件,以便在SharePoint中使用.正在生成以下用于参数的WSDL:
<s:element minOccurs="0" maxOccurs="1" name="url" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="list" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="query" type="s:string" />
<s:element minOccurs="1" maxOccurs="1" name="noOfItems" type="s:int" />
<s:element minOccurs="0" maxOccurs="1" name="titleField" type="s:string" />
Run Code Online (Sandbox Code Playgroud)
为什么int参数将minOccurs设置为1而不是0,我该如何更改?
我试过以下但没有成功:
[XmlElementAttribute(IsNullable=false)] 在参数声明:没有区别(当你想到它时,预期)
[XmlElementAttribute(IsNullable=true)] 在参数声明中:给出错误"对于值类型System.Int32,IsNullable可能不是'true'.请考虑使用Nullable代替."
将参数类型更改为int?:保持minOccurs="1"并添加nillable="true"
[XmlIgnore] 在参数声明中:参数永远不会输出到WSDL
我在Opportunity和自定义实体之间创建了一个(多对多)关系.CRM自动打破与称为" 相交表 " 的内置表的关系.
在Plug-in Registeration Tool中,我想在此特定表上添加Create/Update/Delete消息.但问题是它并不存在 - 甚至那里也不存在多对多的系统关系.
人们可能会建议我手动破坏关系,以便在注册工具中显示.但是有没有解决方案来访问这个内置表?
sharepoint ×4
web-services ×2
asp.net ×1
asp.net-mvc ×1
dispose ×1
dynamics-crm ×1
failover ×1
linq ×1
list ×1
moss ×1
replication ×1
rhino-mocks ×1
sql ×1
xslt ×1
xslt-1.0 ×1