This is a migrated thread and some comments may be shown as answers.

Error on Preview with Sharepoint 2007

0 Answers 55 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Bartdesign
Top achievements
Rank 2
Bartdesign asked on 26 Apr 2011, 11:30 PM
Hi,

I'm trying to build some reports using an SharePoint 2007 list enclosed in a ObjectDataSource to access the data at design-time. However I can not get the preview function of the reporting designer to work. If I paste the dataobject code in an console application it works perfectly. But if i use it in a reporting project(class lib) I get the following error: "The web application could not be found." I've triple checked everything, but it still gives me the error.

Here is my dataobject code:

namespace ReportingTest2
{
    [System.ComponentModel.DataObject()]
    public class UrenSpecificatieDS : List<UrenSpecificatieItemObj>
    {
        [System.ComponentModel.DataObjectMethod(System.ComponentModel.DataObjectMethodType.Select)]
        public List<UrenSpecificatieItemObj> GetUrenBetweenDates(DateTime beginDate, DateTime endDate)
        {
            if (beginDate != null && endDate != null)
            {
                using (SPSite site = new SPSite("http://devserver"))
                {
                    using (SPWeb web = site.OpenWeb())
                    {
                        SPList spUrenSpecificatieList = web.Lists["HourRegistration"];
                         
                        SPQuery query = new SPQuery();
                        query.Query = "<Query><Where><And><Geq>" +
                                      "<FieldRef Name=\"Date\" /><Value IncludeTimeValue=\"TRUE\" Type=\"DateTime\">2011-04-01T02:18:48Z</Value>" +
                                      "</Geq><Leq>" +
                                      "<FieldRef Name=\"Date\" /><Value IncludeTimeValue=\"TRUE\" Type=\"DateTime\">2011-04-24T02:18:50Z</Value>" +
                                      "</Leq></And></Where></Query>";
 
                        foreach (SPItem item in spUrenSpecificatieList.GetItems(query))
                        {
                            UrenSpecificatieItemObj ur = new UrenSpecificatieItemObj();
                            ur._Date = getDateField(item, "Date");
                            string[] split = { ";#" };
                            ur.Company = getStringField(item, "Company").Split(split, StringSplitOptions.None)[1];
                            ur.Hours = getDecField(item, "Hours");
                            ur.Distance = getDecField(item, "Distance");
                            ur.Description = getStringField(item, "Title");
                            this.Add(ur);
                        }
                    }
                }
                return this;
            }
            return null;
        }
// omitted the helper methods.
}
So this code works in an console app, but not when previewing the report in a class library.

When I search for the errors about "The webapplication is not found" and there are some mentions about using x64 builds. I've tried to set my project to x64 exclusive, but Visual Studio 2008 gives an error about some assembly's beeing wrong but I guess that is probably of some dependencies of the reporting control. I'm using Windows 2008 x64 as dev platform.

I hope somebody can shed some light on this, as I would like to use the full design time controls to create my report. Any help is grealty appreciated.

No answers yet. Maybe you can help?

Tags
General Discussions
Asked by
Bartdesign
Top achievements
Rank 2
Share this question
or