Create DataSource In Code

Stimulsoft Reports.WEB discussion
Post Reply
Chasoo
Posts: 40
Joined: Wed Oct 19, 2011 1:29 am

Create DataSource In Code

Post by Chasoo »

Hi,

I try to Create a Datasource in Code.but it always giving me a trouble. my code is looks like :

StiReport stiReport = new StiReport();
stiReport.Dictionary.Databases.Add(new StiOleDbDatabase("ReportdesignerConnectionName",
Presenter.GetCurruentConnectionString()));

// Create DataSource and add it to dictionary
StiDataSource t = new StiOleDbSource("ReportdesignerConnectionName","test","test","select * from users",true,false);
stiReport.Dictionary.DataSources.Add(t);

stiWebDesigner.Design(stiReport);

and when i got in to the designer it has given me the out put as:

Image

Uploaded with ImageShack.us

i want only one dataconnection (which is appear in the top.) and i want my datasource to appear inside my first dataconnection

is that possible?
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Create DataSource In Code

Post by Alex K. »

Hello,

Please try to change you code on the following:

Code: Select all

StiReport stiReport = new StiReport();
stiReport.Dictionary.Databases.Add(new StiOleDbDatabase("ReportdesignerConnectionName", Presenter.GetCurruentConnectionString()));
// Create DataSource and add it to dictionary
StiOleDbSource t = new StiOleDbSource("ReportdesignerConnectionName","test","test","select * from users",true,false);
stiReport.Dictionary.DataSources.Add(t);
stiWebDesigner.Design(stiReport);
Thank you.
Post Reply