set datasource
set datasource
Hello
i want to set datasource of report in runtime,pleas help me to do it
i want to set datasource of report in runtime,pleas help me to do it
set datasource
Hello,
You can use the RegData(DataSet) method or use the following code:
New connection string:
Add DataSources:
Add Columns:
Add Relations:
Thank you.
You can use the RegData(DataSet) method or use the following code:
New connection string:
Code: Select all
report.Dictionary.Databases.Clear();
report.Dictionary.Databases.Add(new Stimulsoft.Report.Dictionary.StiSqlDatabase("Connection", newConnectionString));
Code: Select all
StiSqlSource DS1 = new StiSqlSource("Connection", "DS1", "DS1", "SELECT * FROM DS1", true, false);
report.Dictionary.DataSources.Add(DS1);
Code: Select all
foreach (DataColumn col in dataTableDS1.Columns)
{
DS1.Columns.Add(col.ColumnName, col.DataType);
}
Code: Select all
StiDataRelation dataRelation = new StiDataRelation("MyRelation", parentDS, childDS, new string[] { "Field" }, new string[] { "Field" });
report.Dictionary.RegRelations();
report.Dictionary.Relations.Add(dataRelation);
set datasource
Thank you for your reply.
I dont want to create datasource on runtime,i want to set the datatable of datasource in runtime.i dont want to use select command on runtime.i have a datatable and want to append it to datasources datatable.please help me.
I dont want to create datasource on runtime,i want to set the datatable of datasource in runtime.i dont want to use select command on runtime.i have a datatable and want to append it to datasources datatable.please help me.
set datasource
Hello.
Thank you.
If you have a datatable you should use RegData(string name, System.Data.DataTable dataTable) method.roya wrote:Thank you for your reply.
I dont want to create datasource on runtime,i want to set the datatable of datasource in runtime.i dont want to use select command on runtime.i have a datatable and want to append it to datasources datatable.please help me.
Thank you.
set datasource
Hello,
I have a similar problem:
- I use one xml-file to design my report
- In a secound step I wantto use this report to create output from different datasource
my code is
but allways the content from the datasource defined in reportFile is used.
How can I change the data file?
I have a similar problem:
- I use one xml-file to design my report
- In a secound step I wantto use this report to create output from different datasource
my code is
Code: Select all
dataSet1.ReadXmlSchema(schemaFile);
dataSet1.ReadXml(xmlFile);
//Add data to datastore
StiReport report = new StiReport();
report.Load(reportFile);
report.RegData(dataSet1);
report.ShowWithWpf();
How can I change the data file?
set datasource
Hello,
Please send us your report with test data for analysis.
Thank you.
Please send us your report with test data for analysis.
Thank you.
set datasource
Hello
I attach the file
The report uses file TestFoo.xml as data-source and it's displaying "Foo"
in the csharp code I use Testbar.xml as data-source and this should display "Bar", but it also shows "Foo"
if you try the code, you only have to press "Build Report", the XSD and XML is hard-coded in this version.
Thank you
Clemens
I attach the file
The report uses file TestFoo.xml as data-source and it's displaying "Foo"
in the csharp code I use Testbar.xml as data-source and this should display "Bar", but it also shows "Foo"
if you try the code, you only have to press "Build Report", the XSD and XML is hard-coded in this version.
Thank you
Clemens
- Attachments
-
[The extension xaml has been deactivated and can no longer be displayed.]
-
- 1885.Window1.xaml.cs
- (3.46 KiB) Downloaded 629 times
-
- 1884.TestBar.xml
- (221 Bytes) Downloaded 439 times
-
- 1883.TestFoo.xml
- (221 Bytes) Downloaded 434 times
-
- 1882.TestFooBar.xsd
- (1.1 KiB) Downloaded 424 times
-
- 1881.TestFooBar.mrt
- (6.2 KiB) Downloaded 675 times
set datasource
Hello,
Please check the folowing code:
Thank you.
Please check the folowing code:
Code: Select all
...
report.Load("TestFooBar.mrt");
report.Dictionary.Databases.Clear();
report.Dictionary.DataSources.Clear();
report.RegData(dataSet1);
report.Dictionary.Synchronize();
...
report.ShowWithWpf();
set datasource
Hello
in this case it works, but in a more complex I am running in an endless loop.
Thank you,
Clemens
in this case it works, but in a more complex I am running in an endless loop.
Code: Select all
private string schemaFile = "C:\\temp\\birt\\Paket_Fachklasse_neu.xsd";
private string xmlFile = "C:\\temp\\birt\\Paket_Fachklasse.xml";
public Window1()
{
Stimulsoft.Report.Wpf.StiThemesHelper.LoadTheme(this);
InitializeComponent();
dataSet1.DataSetName = "Demo";
}
private void Button_Click(object sender, RoutedEventArgs e)
{
dataSet1.ReadXmlSchema(schemaFile);
dataSet1.ReadXml(xmlFile);
//Add data to datastore
StiReport report = new StiReport();
report.Load("C:\\temp\\birt\\Crash.mrt");
report.Dictionary.Databases.Clear();
report.Dictionary.DataSources.Clear();
report.RegData(dataSet1);
report.Dictionary.Synchronize();
report.ShowWithWpf();
}
Clemens
- Attachments
-
- 1898.Paket_Fachklasse.xml
- (121.51 KiB) Downloaded 449 times
-
- 1897.Paket_Fachklasse_neu.xsd
- (7.31 KiB) Downloaded 442 times
-
- 1896.Crash.mrt
- (34.52 KiB) Downloaded 456 times
set datasource
Thank you for your reply
your suggestion worked and i used it , but if i have different datasources and i want to set the datatatables of them in runtim how can i determine them?
i shoulde write different RegData() ?
your suggestion worked and i used it , but if i have different datasources and i want to set the datatatables of them in runtim how can i determine them?
i shoulde write different RegData() ?