谁能告诉我此caml查询代码出了什么问题?
|
查询:
<Where>
<Eq>
<FieldRef Name=\'Document Type\' LookupId=\'True\' />
<Value Type=\'Text\'>Standards(STA)</Value>
</Eq>
</Where>
<OrderBy>
<FieldRef Name=\'Number\' Ascending=\'False\'/>
</OrderBy>
<RowLimit>1</RowLimit>\"
代码上下文:
<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">
<%@ Import Namespace=\"System.IO\" %>
<%@ Import Namespace=\"Microsoft.SharePoint\" %>
<%@ Page Language=\"C#\" inherits=\"Microsoft.SharePoint.WebPartPages.WebPartPage, Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c\" %>
<%@ Register tagprefix=\"WebPartPages\" namespace=\"Microsoft.SharePoint.WebPartPages\" assembly=\"Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c\" %>
<%@ Register tagprefix=\"SharePoint\" namespace=\"Microsoft.SharePoint.WebControls\" assembly=\"Microsoft.SharePoint, Version=14.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c\" %>
<html>
<head>
<meta name=\"WebPartPageExpansion\" content=\"full\" />
<meta name=\"ProgId\" content=\"SharePoint.WebPartPage.Document\" />
<h1>T-Site</h1>
<script runat=\"server\" type=\"\">
protected void sevak(object sender, EventArgs e)
string lastitem;
try
{
using (SPSite objsite = new SPSite(\"http://...\"))
{
using (SPWeb objWeb = objSite.OpenWeb())
{
SPList objList = objWeb.Lists[\"....\"];
SPQuery objQuery = new SPQuery();
objQuery.Query = \"<Where><Eq><FieldRef Name=\'Document Type\' LookupId=\'True\' /> <Value Type=\'Text\'>Standards(STA)</Value></Eq></Where><OrderBy><FieldRef Name=\'Number\' Ascending=\'False\'/></OrderBy><RowLimit>1</RowLimit>\";
objQuery.Folder = objList.RootFolder;
SPListItemCollection colItems = objList.GetItems(objQuery);
if (colItems.Count>0)
{
lastitem=colItems(0);
}
else
{
Label1.Text=\"noItem\";
}
}
}
}
catch (Exception ex)
{
return ex;
}
Label1.Text= \"lastitem\";
<SharePoint:CssLink runat=\"server\"></SharePoint:CssLink>
<SharePoint:ScriptLink runat=\"server\" language=\"javascript\" name=\"core.js\">
</SharePoint:ScriptLink>
<body>
<form id=\"form1\" runat=\"server\" action=\"Page-2.aspx\">
<p>
<asp:Button runat=\"server\" Text=\"Submit\" id=\"Button1\" OnClick=\"sevak\" ></asp:Button>
</p>
<p><asp:Label runat=\"server\" id=\"Label1\"></asp:Label></p>
</form>
</body>
</html>
没有找到相关结果
已邀请:
1 个回复
门锑腺潮