Two Data Sources

Stimulsoft Reports.WEB discussion
Post Reply
galawij
Posts: 16
Joined: Sat Feb 11, 2012 4:37 am
Location: U.S

Two Data Sources

Post by galawij »

Hello Everybody,
I Have a question and I need Your help,PLS.
I want to create a report with two data sources(Two Stored Procedures).One for report and another for fill a object of the form.
I searched,Bud I didnot find a similar sample...
How can I Send two data sources from Visual Studio to the report?(I am Programming with ASP.Net and SQl)
Please put a sample for me(Or a Link).
I hope I made myself clear.
Thank you so much.

Regards Galawij.
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Two Data Sources

Post by Alex K. »

Hello,

As a way, create two datatable for each procedure and put them in dataset and than register this dataset to report.

Thank you.
galawij
Posts: 16
Joined: Sat Feb 11, 2012 4:37 am
Location: U.S

Two Data Sources

Post by galawij »

Thank you,Aleksey.
But I do not Know How Can I create Two data sources in a report??
Could you explain it in more details?
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Two Data Sources

Post by Alex K. »

Hello,

Please see the following code:

Code: Select all

DataSet ds = new DataSet("Data");
SqlDataAdapter da1 = new SqlDataAdapter("exec proc1", connection);
DataTable dt1 = new DataTable("DataSource1");
da1.Fill(dt1);
SqlDataAdapter da2 = new SqlDataAdapter("exec proc2", connection);
DataTable dt2 = new DataTable("DataSource2");
da2.Fill(dt2);

ds.Tables.Add(dt2);
report.RegData(ds);
Thank you.
Rodrigo
Posts: 15
Joined: Mon Jun 14, 2010 5:00 am

Two Data Sources

Post by Rodrigo »

You can create a DataSet with 2 DataTables in .NET and two DataSources as DataTables in report.
stjohn
Posts: 8
Joined: Fri Mar 09, 2012 6:43 am

Two Data Sources

Post by stjohn »

ds.Tables.Add(dt2);
report.RegData(ds);

may i know , why it only assign dt2 into dataset and bind it out.

if let say, dt1 and dt2 is totally different data.then is it still working with this method?
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Two Data Sources

Post by Alex K. »

Hello,

Sorry, maybe we did not exactly understand your question. Could you explain your issue in more details?

Thank you.
stjohn
Posts: 8
Joined: Fri Mar 09, 2012 6:43 am

Two Data Sources

Post by stjohn »

Aleksey wrote:Hello,

Please see the following code:

Code: Select all

DataSet ds = new DataSet("Data");
SqlDataAdapter da1 = new SqlDataAdapter("exec proc1", connection);
DataTable dt1 = new DataTable("DataSource1");
da1.Fill(dt1);
SqlDataAdapter da2 = new SqlDataAdapter("exec proc2", connection);
DataTable dt2 = new DataTable("DataSource2");
da2.Fill(dt2);

ds.Tables.Add(dt2);
report.RegData(ds);
Thank you.
ok...

refer to this examples. da1 and da2 will read the data source by exec stored procedure. but i have follow this way to bind my data into report.
but i found that, the two cross tab actually is not bind properly. some more get a lot of error in binding report field. At the end, get error of 'Object reference not set to an instance of an object' while reportdataset is pass to stimul report viewer.

so, my question is: whether this method above it is work for 2 sql statement/ stored procedure bind into two cross tab???

i tried many times and tested, i believe that this method are not able to bind two cross tab.
correct me if i'm wrong. thank you!!!
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Two Data Sources

Post by Alex K. »

Hello,

Please send us a sample project which reproduces the issue for analysis.

Thank you.
Post Reply