Hello all,
I am using StimulReport 2007.1 for .NET 1.1 and have to solve
following situation.
1. I have do design a Report - the underlaying datasource is
a dataset with an inline-scheme and inline-information about
relations as shown in your samples.
ds = new DataSet( "DataSetName" );
r = new StiReport();
r.Load( reportFile );
r.DataSources.Clear();
r.DataStore.Clear();
ds.ReadXml( , XmlReadMode.ReadSchema );
r.RegData( "AnyName", ds );
r.Design( );
This works very well. I am able to design the report and because
of the data within the dataset I can do a preview too!
No problem so far... But now the problems came up...
2. I have to connect the Report to Remote Datasources.
Sample:
server=;database=;trusted_connection=yes
The Server (of course), and the DatabaseName can change. It is guaranteed
that the Tables/Relations are the same - with other data of course - but
the scheme is the same.
How can I solve this?
r = new StiReport();
r.Load( reportFile );
r.DataSources.Clear();
r.Dictionary.Clear();
r.Dictionary.Databases.Add(new StiSqlDatabase("AnyName", ));
I am getting the following Errormessage:
error CS0246: The type or namespace name 'Mis_Kunde'
could not be found (are you missing a using directive or an assembly reference?)
'Mis_Kunde' is a table in the datasource which is available and readable.
Can you point me in the right direction or are the better ways to solve such an issue.
Thank you in advance for your help, Günther
One Report, Different Datasources (Local: Dataset, Remote: SqlServer)
One Report, Different Datasources (Local: Dataset, Remote: SqlServer)
Does the report already have the remote Datasource defined and it's that you want to change it's connection string based on a connection string from your client application?
If so then after load call your report.Load(filename) you can get the SqlDatabase datasource from the report and edit it's connection string
Also, I think you need to remove the following lines
unless you need them, but what they are doing is clearing any Datasources you've previously defined in the report.
If so then after load call your report.Load(filename) you can get the SqlDatabase datasource from the report and edit it's connection string
Code: Select all
Stimulsoft.Report.Dictionary.StiSqlDatabase sqlDB = report.Dictionary.Databases["MY_DB_NAME"] as Stimulsoft.Report.Dictionary.StiSqlDatabase;
if(sqlDB != null)
{
sqlDB.ConnectionString = "My Connection String";
}
Also, I think you need to remove the following lines
Code: Select all
r.DataSources.Clear();
r.DataStore.Clear();
One Report, Different Datasources (Local: Dataset, Remote: SqlServer)
Please note also the following fact. First your data was in the DataSource in DataSet. Then you added a new SQLConnection to your new data. But now there should be a SQL based DataSource for correct access to the remote data.
So you need add a new SqlDataSource object with correct SQL to the report's Dictionary.
Thank you.
So you need add a new SqlDataSource object with correct SQL to the report's Dictionary.
Thank you.