Data source not showing up

Stimulsoft Reports.Silverlight discussion
Locked
GeertvanHorrik
Posts: 3
Joined: Tue Dec 13, 2011 10:49 am

Data source not showing up

Post by GeertvanHorrik »

I have a designer control on my silverlight page and want to add a new report with customized data sources. So, basically this is how I initialize the report:

Code: Select all

string databaseAlias = string.Format("{0} database", applicationModel.Application.Name);

report.Dictionary.Databases.Clear();
report.Dictionary.Databases.Add(new StiSqlDatabase("Database", databaseAlias, applicationModel.Application.ConnectionString));

foreach (var table in applicationModel.Entities)
{
    var dataSource = new StiSqlSource("Database", table.Name, databaseAlias, string.Format("SELECT * FROM [{0}].[{1}]", table.SchemaName, table.Name));

    foreach (var tableField in table.Fields)
    {
        dataSource.Columns.Add(tableField.Name, tableField.DisplayName, typeof(string));
    }

    report.Dictionary.DataSources.Add(dataSource);
}
After the report is initialized, I set it like this (too bad the Report property is not bindable):

Code: Select all

reportDesigner.Report = ViewModel.Report;
However, I don't see any of the data sources that I have created. I have to admit that I am having a hard time using your controls, because all documentation and videos are not talking about the StiSLDesignerControl, but about a different control. This makes it hard to set up a first working example.

I don't want to call report.Design because then it will create the designer in modal mode, and I don't want that.

Thanks in advance!
GeertvanHorrik
Posts: 3
Joined: Tue Dec 13, 2011 10:49 am

Data source not showing up

Post by GeertvanHorrik »

A small update: I get this exception when using QuickWatch to view the added databases via report.Dictionary.Databases

Unable to cast object of type 'System.Object[]' to type 'Stimulsoft.Report.Dictionary.StiDatabase[]'.
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Data source not showing up

Post by Alex K. »

Hello,

Can you please send us a sample project which reproduces the issue for analysis.

Thank you.
GeertvanHorrik
Posts: 3
Joined: Tue Dec 13, 2011 10:49 am

Data source not showing up

Post by GeertvanHorrik »

Thanks, I have sent a complete sample application to support[@]stimulsoft[dot]com.
Andrew
Posts: 4108
Joined: Fri Jun 09, 2006 3:58 am

Data source not showing up

Post by Andrew »

Ok! Thank you.
gustavo
Posts: 16
Joined: Fri Jan 06, 2012 11:23 am

Data source not showing up

Post by gustavo »

Maybe it is the same problem as mine...

http://forum.stimulsoft.com/Default.aspx?g=posts&t=4930

Just insert this code before InitializeComponent()

Code: Select all

Stimulsoft.Report.StiOptions.Silverlight.WCFService.UseWCFService = True
and then it appears at the Dictionary sources...
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Data source not showing up

Post by HighAley »

Hello.
gustavo wrote:Maybe it is the same problem as mine...

http://forum.stimulsoft.com/Default.aspx?g=posts&t=4930

Just insert this code before InitializeComponent()

Code: Select all

Stimulsoft.Report.StiOptions.Silverlight.WCFService.UseWCFService = True
and then it appears at the Dictionary sources...
This property will help if WCF service is used.

Thank you.
Locked