Page 1 of 1
Two Data Sources
Posted: Mon Feb 20, 2012 6:54 am
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.
Two Data Sources
Posted: Tue Feb 21, 2012 2:19 am
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.
Two Data Sources
Posted: Wed Feb 22, 2012 1:32 am
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?
Two Data Sources
Posted: Wed Feb 22, 2012 6:09 am
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.
Two Data Sources
Posted: Thu Mar 01, 2012 6:23 am
by Rodrigo
You can create a DataSet with 2 DataTables in .NET and two DataSources as DataTables in report.
Two Data Sources
Posted: Fri Mar 09, 2012 6:44 am
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?
Two Data Sources
Posted: Fri Mar 09, 2012 8:59 am
by Alex K.
Hello,
Sorry, maybe we did not exactly understand your question. Could you explain your issue in more details?
Thank you.
Two Data Sources
Posted: Mon Mar 12, 2012 5:35 am
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!!!
Two Data Sources
Posted: Tue Mar 13, 2012 6:25 am
by Alex K.
Hello,
Please send us a sample project which reproduces the issue for analysis.
Thank you.