.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

SPDataSource returning 0 results when used in CrossList Mode

Posted By:      Posted Date: August 27, 2010    Points: 0   Category :SharePoint


I'm writing a web part in C# to query several document libraries, using a SPDataSource with the results going to a SPGridView.

I got the query to work just fine with a single document library, but when I switched the SPDataSource to CrossList mode (and added the "Web" and "Lists" tags to the query), I end up with no results. I've done a lot of digging around on the web for examples of how to do this correctly, but always end up with the same result, no hits.

These are the only properties I'm setting on the data source:


ds.DataSourceMode = SPDataSourceMode.CrossList;

ds.UseInternalName = true;

ds.SelectCommand = queryString;

The query string looks like this (I added the formatting for readability... the actual query string is all a single line):

<Webs Scope='SiteCollection'></Webs

View Complete Post

More Related Resource Links

Resolving ListId and WebId when using SPDataSource in CrossList Mode



I am currently making use of the SPDataSource for CrossList rollups, which is excellent for my requirement. The SPDataSource returns the ListID and WebID of the item at each row, How can i resolve these GUIDs to a more userfriendly Title and URL.


Search query returning 0 results

I'm using a query which returns 0 results but was working some weeks ago.  I checked the code and nothing has changed since then.  I created a Search Center Site on another port and using the same terms I get many results there.  I checked my scopes and they are all right. Nothing changed there either. Could someone help me figure out what may be the problem in my query.  Or maybe it's my Scopes/Content Sources configuration. SELECT URL, FileName, Title, Description, Rank, Size, HitHighlightedSummary, Path FROM SCOPE() WHERE freetext(defaultproperties, ' +légumes')  AND ( "scope" = 'Scope - My Portal - All Site - fr'  )    ORDER BY Rank DESCDaniel Siconnelli There is neither good nor evil... only mogwais and gremlins

SharePoint Server 2010 Search - not returning results but crawling without errors

I have created a Search Service Application on a SharePoint Server 2010 (RTM) Farm and used the default Content Source. I started a Full Crawl and it suceeded with no errors etc. I ran it a few times and no issues. But if I go to the Intranet Portal Web Appliaction and do a search for a document that would have been crawled it does not show up in search results...nothing does. I am not getting any errors in Event Log or ULS Logs relevant to Search. How can I troubleshoot this problem further?SharePoint Solution Architect, Perth Australia - Microsoft Virtual Technology Specialist - MCTS WSS Dev, WSS Adm, MOSS Dev, MOSS Adm - http://wss.made4the.net/ - Founder of http://www.sharepointdevwiki.com/

gridview is not returning results..

Gridview is not being populated now that i built my objectdatasource in the code behind.. why. If i build the source on the aspx page and configure it that way, it returns results.. but when i try to build it in the code behind it just displays my empty template for the gridview.01.protected void btSearchDVR_Click(object sender, EventArgs e) 02.{ 03. if (ddlDVR.SelectedValue == "0") 04. { 05. rfvDVR.IsValid = false; 06. } 07. else 08. { 09. ObjectDataSource ObjectDataSource1 = new ObjectDataSource("DataAccessCode", "SelectDVRInfo"); 10. ObjectDataSource1.SelectParameters.Add("@dvrName", TypeCode.String, ddlDVR.SelectedValue.ToString()); 11. ObjectDataSource1.DataBind(); 12. 13. GridView1.DataSource = ObjectDataSource1.ID; 14. GridView1.Visible = true; 15. GridView1.DataBind(); 16. } 17.}  

MOSS Search Not Returning Results from A List

Hello All,   Problem: The MOSS Search is not returning results from a subsite (and list within it). It however returns results for most of the other sites in the web application. Environment: 2 Application Servers. One of these is the index and query server. The same server is also the search server for the content databases. 5 web front end servers. Other Notes: The MOSS installation has several web applications. We however have one site within it that is not returning the required results. The results that we are looking for are located in a particular list. When one searches against the items in the list, some appear and others do not. We also get results from RSS feeds that track changes to the list in the last week. Also, some of the results returned are links to the new item in the list (that is, when you click on new to create a new item). There are no search errors in the application log. The web application was recently upgraded from WSS 3.0 on a single server to MOSS 2007 in a server farm. There are no sql index errors. The WSS Search and Office Search Services are working and have been restarted. The credentials have also been re-entered. We get less than 20 errors in the crawl logs (out of close to 800k docs). I have checked the rights for the default content access account, and it has dbo rights to the content db and search db. It also has read (and now admin

Why is SharePoint people search returning the same results as all sites search?


I've been having issues with the people search in that it doesn't return any results and the scope is 0.

I deleted the scope and recreated it adding the rule contentclass = urn:content-class:SPSPeople with behaviour : require but now when i search for people it seems to search everything not just people profiles. Please can someone tell me what I have done wrong when I recreated the scope? The scope still cant crawl the profiles but I'd like to at least get back to where i was before!!


SQL & JavaScript - Apostrophe Issue, SELECT statement is not returning any results.



Any help would be great on this.

I have the following code within an .asp page in JavaScript:

function SDsitecalls1(Sitename)

end function

The function is called via the below:

 <td style="width: 114px" class="style65"><a href="/suppdesk/customercalls.asp?customer=BSFMAN&site=Our+Lady''s+R+C+Sports+College"><%=SDsitecalls1("Our Lady's R C Sports College - Hbev")%></a></td> 

When this is ran I do not receive any errors but the SELECT command doesn't return any results (Just a 0). I've tried a few different methods such as using the Parameter SiteName and Single/Double Apostrophes however I either receive an error or blank results.

The function works with all other names however the apostrophe seems to cause issues here. Is there a way to extract the data without editing the SQL?

Thanks very much for the help,


CQWP results show only in Edit Mode



I added a CQWP to aggregate all Tasks within my site collection. It all works fine in Edit Mode and the correct tasks are displayed (it shows only the current user's uncompleted tasks).

However, as soon as I Exit Edit Mode the results disappear and the Content Query Web Part tells me "No items available". I switch back to Edit Mode: the items re-appear.

Any ideas what I am doing wrong?

Data List Returning Incomplete Results


Hi All

I have a page where users can search by company name, the data list is pulled from an Excel spreadsheet hosted on the site.  I'm seeing some strange results returned, for example:

In the company field say there are the following entries:

Anns Company
Bernards Business
Company B
Dermots Domain
Property Company

If I search for "Com" I get the following returns (correct):

Anns Company
Company B
Property Company

If I search for "Der" I get my "Sorry there are no matching results" message (Incorrect)

If I search for "Ann" I get the following returns (Correct):

Anns Company

And if I search for "e" I get the following returns (Correct):

Bernards Business
Dermots Domain
Property Company

It seems random as to why it doesn't return some values, I've tried moving rows around to see if that's the problem but it makes no difference.  My range is set correctly in the spreadsheet.

When I debug the VB code behind, when I search for something that works correctly e.g. "Com" in the above example, once enter the value and click search Visual Studio begins steping into

Sum Function Not returning proper results


I was wondering if someone could explain to me why this isn't returning the correct answer. 

Create View [dbo].[viewWyanAvail]


SELECT 'Wyan4' As TableGroup, Event_Type, Unit_Code, EventStartTS, EventEndTS, Avail_Cap 

FROM dbo.Wyan4 


SELECT 'Wyan5' As TableGroup, Event_Type, Unit_Code, EventStartTS, EventEndTS, Avail_Cap 

FROM dbo.Wyan5


SELECT 'Wyan6' As TableGroup, Event_Type, Unit_Code, EventStartTS, EventEndTS, Avail_Cap 

FROM dbo.Wyan6


SELECT 'Wyan7' As TableGroup, Event_Type, Unit_Code, EventStartTS, EventEndTS, Avail_Cap 

FROM dbo.Wyan7



Create FUNCTION [dbo].[fncGetDesignated_Amount_WyanAvail] (

	@TableGroup varchar(10),

	@Unit_Code varchar(5))




declare @Amount float

if not exists (select 1 from dbo.viewWyanAvail)

    select top 1 @Amount = Amount

 from dbo.Designated_Amount

Where Unit_Code = @Unit_Code


select top 1 @Amount = CAST(dbo.Designated_Amount.Amount AS Float) 

 FROM dbo.Designated_Amount INNER JOIN

 dbo.viewWyanAvail ON dbo.Designated_Amount.Unit_Code = dbo.viewWyanAvail.Unit_Code 

 WHERE not exists (SELECT 1

FROM dbo.Designated_Amount INNER JOIN

 dbo.viewWyanAvail ON dbo.Designated_Amount.Unit_Code = dbo.viewWyanAvail.Unit_Code

WHERE dbo.viewWyanAvail.Avail_Cap = 0 AND dbo.viewWyanA

Small Search Box Returning No Results




The small search box on the top page of the site returns no results, but when I do the same query in a search page, I get the expected number of results (more than zero).  I've poked around in the search settings on Central Administration, but I can't seem to find anything.  Has anyone run in to anything like this before?  Thanks!


CAST returning wrong results


Hi everyone,


I have a problem with the CAST. My code is this:


		CAST((1 + CAST((SELECT f2.Amount FROM FactSekas f2 WHERE f2.AccountChildCod = 'CL00100003' AND f2.Year = f.Year) AS DECIMAL(38, 18)) / 100) AS DECIMAL(38, 18)) AS DECIMAL(38, 18)) AS Rezult_18
		, CAST(CAST(f.Amount AS DECIMAL(38, 28))
		CAST((1 + CAST((SELECT f2.Amount 

SharePoint Search Not Returning Results

My SharePoint search is not returning results for anything but people. I'm not seeing any errors in the ULS log and my index contains rough 27,000 documents. What could be the problem? Where can I look for details that could shed some light on why there are no results being returned?

search not returning correct results


On my sharepoint, when I enter in bayliners in my search it returns me nothing related to bayliner boats, but when I enter in bayliner it returns me everything bayliner related, how can I get my search to return data for bayliner even though the user entered in bayliners in the search box?

My search results page is using an XSL file to show the data

Returning a DataSet From a Web Services: Step-by-Step

This Example Shows how to create a webservice which returns a DataSet and a Client Which displays the DataSet in a Grid.


This Example Shows how to create a webservice which returns a DataSet and a Client Which displays the DataSet in a Grid.

Need Syntax To Make Results of LINQ Union Return Non-Generic Type



I have the below SQL which works just fine:

SELECT     Message, CreateDate, AccountId, AlertTypeId
FROM       dbo.Alerts
SELECT     TOP (100) PERCENT Status, CreateDate, AccountId,
                          (SELECT     10 AS Expr1) AS AlertTypeId
FROM         dbo.StatusUpdates
WHERE AccountId = PassedInParameter

I have been going about trying to convert the above into a LINQ method and am having problems with return types.
As the above SQL illustrates, I am querying two distinct LINQ tables - Alerts and StatusUpdates -
and then attempting to perform a Union on them. In order to do the union in LINQ, I have to have agreeing types. So, I
am using "var" to make the results of "alerts" and "updates" generic before the union.  

public IList GetStatusUpdatesAsAlertsByAccountId<T>(Int32 accountId)
            using (WorkbookDataContext dc = _conn.GetCont

sqlDataReader dos not get results


I am trying to run a stored proc from this function. When I run it thorugh the debugger I can see that myReader.HasRows = true and myReader.FieldCount =14.

But the control does not go in the loop while (myReader.Read()) where I am trying to read Version field returned by the stored proc.

Pls check me code and suggest correction. Thank You.

private static int Get_CaseInfo(string CaseNum)
            int Ver = 0;
            String myConn = ConfigurationManager.ConnectionStrings["DBConnectionString"].ToString();
            SqlConnection conn = new SqlConnection(myConn);
            SqlCommand cmd = new SqlCommand();
            cmd.CommandType = System.Data.CommandType.Text;

            SqlDataReader myReader = null;
            String stmt1 = "EXEC [REPORTS].[CaseInfoByCaseNo_Get] @CaseNo = '" + CaseNum + "'"; 
            cmd.CommandText = stmt1;
            cmd.Connection = conn;
                myReader = cmd.ExecuteReader();
                while (myReader.Read())
                    Ver = (int)myReader["Version"];

            catch (Exception)
            return Ver;         

ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend