Skip to Content
author's profile photo Former Member
Former Member

CRVS2010 Beta - Crash on SetDataSource

I have a simple report that I am trying to get to run in a C#/Visual Studio 2010 WPF project. I am trying to populate the data from a dataset that I am populating from a list. The following code populates the dataset:

private MainDataSet GetDataSetFromList(List<MainBvaReportRecord> lst)

{

MainDataSet ds = new MainDataSet();

MainDataSet.BVA_TEST_DATA_VIEWDataTable dt = (MainDataSet.BVA_TEST_DATA_VIEWDataTable)ds.Tables[0];

foreach (MainBvaReportRecord rcd in lst)

{

DataRow row = dt.NewRow();

row["HOSPITAL_NAME"] = rcd.HospitalName;

row["DEPARTMENT_NAME"] = rcd.DepartmentName;

row["DEPARTMENT_ADDRESS"] = rcd.DepartmentAddress;

row["DEPARTMENT_DIRECTOR"] = rcd.DepartmentDirector;

row["DEPARTMENT_PHONE_NUMBER"] = rcd.DepartmentPhoneNumber;

row["FIRST_NAME"] = rcd.FirstName;

row["MIDDLE_NAME"] = rcd.MiddleName;

row["LAST_NAME"] = rcd.LastName;

dt.Rows.Add(row);

}

return ds;

}

I try and use the dataset in the Window_Loaded event:

try

{

List<MainBvaReportRecord> list = new MainBvaReportRecordDataAccess().SelectList();

MainDataSet ds = this.GetDataSetFromList(list);

rpt.SetDataSource(ds.Tables[0]);

}

catch (Exception ex)

{

MessageBox.Show(ex.Message);

}

view.ReportSource = rpt;

The call to SetDataSource crashes without a catchable exception. I have tried passing just the raw dataset (ds) to SetDataSource with the same results. The dataset is an unbound set defined in DataSet1.xsd, and consists of string data types. The list is populated by a stored procedure that is selecting from a view (if that helps). I have tried running the report against the view itself (using the Database Expert to switch out between the dataset and the view), and the report will run, but only gets two records (there are 50 records in my test database). I really need to be able to set the data source to a dataset I can control. When completed this report will have several sub-reports, and I need to be able to populate them as well. However, I can't get even the simple case to run. Any help would be appreciated.

Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Jul 02, 2010 at 02:41 PM

    OK, further digging got me a better answer about the exception. The reason I wasn't getting any exception info is that it was looking in the wrong directory for the crdb_adoplus.dll. It was looking for this under the "C:\Program Files\SAP BusinessObjects\SAP BusinessObjects Enterprise XI 4.0\win32_x86\dotnet1" directory. I copied the dll into that directory (I had to creat it on my machine), and that got me a more tracable error: "mixed mode assembly is built against version 'v2.0.50727' of the runtime and cannot be loaded in the 4.0 runtime without additional configuration information." Some digging around on that got me to the following solution. I need to add the following to my *.exe.config file:

    <startup useLegacyV2RuntimeActivationPolicy="true">

    <supportedRuntime version="v4.0"/>

    </startup>

    That gets me over the SetDataSource hurdle. Now, I am only seeing two records of the 50 in the dataset [sigh]

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.