473,231 Members | 1,384 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,231 software developers and data experts.

Reportviewer A data source instance has not been supplied for subreport

I have created a report and subreport in VB/ASP.NET. The report works fine but the subreport will not display. The subreport, when displayed as a standalone report, works fine. But when viewed as a subreport I get the error that the datasource for the subreport is missing.
I set a breakpoint in the sub that should set the subreport's datasource and the breakpoint is never hit. I have added a handler like shown in many examples. Why is the subreportprocessing event never firing? I have spent days trying to figure this out but most examples refer to the WinForms.ReportViewer and
none to the WebForms.ReportViewer. I have never found a complete webforms example using a subreport.
Any help would be greatly appreciated,
Kim
Jun 7 '07 #1
3 35574
adunn
1
This may just be a configuration issue. Check your subreport's Data Sources. The report designer seems greedy and grabs all available datasources. Delete the ones you don't need, and you should be good to go.
Jun 11 '07 #2
Hi Try this , will work for you...


public partial class _Default : System.Web.UI.Page
{
int ordno = 134085104;
string thisConnectionString = "server=.;initial catalog=vivotech;uid=sa;pwd=sql";
SqlConnection thisConnection = new SqlConnection(thisConnectionString);
protected void Page_Load(object sender, EventArgs e)
{
ReportViewer1.Visible = true;

thisConnection.Open();
{
SqlCommand cm = new SqlCommand("Vivo_Report", thisConnection);
cm.CommandType = CommandType.StoredProcedure;
cm.Parameters.Add("OrderNumber", SqlDbType.Int).Value = ordno;
SqlDataAdapter da = new SqlDataAdapter(cm);
System.Data.DataSet thisDataSet = new System.Data.DataSet();
da.Fill(thisDataSet, "Vivo_Report");
ReportDataSource datasource = new ReportDataSource("DataSet1_Vivo_Report", thisDataSet.Tables[0]);
ReportViewer1.LocalReport.DataSources.Clear();
ReportViewer1.LocalReport.DataSources.Add(datasour ce);
this.ReportViewer1.LocalReport.SubreportProcessing += new SubreportProcessingEventHandler(SubreportProcessin gEventHandler);
ReportViewer1.LocalReport.Refresh();
}
thisConnection.Close();
}
protected void Button1_Click(object sender, EventArgs e)
{

}

public void SubreportProcessingEventHandler(object sender, SubreportProcessingEventArgs e)
{
SqlCommand cm = new SqlCommand("Vivo_Report", thisConnection);
cm.CommandType = CommandType.StoredProcedure;
cm.Parameters.Add("OrderNumber", SqlDbType.Int).Value = ordno;
SqlDataAdapter da = new SqlDataAdapter(cm);
System.Data.DataSet thisDataSet = new System.Data.DataSet();
da.Fill(thisDataSet, "Vivo_Report");
e.DataSources.Add(new ReportDataSource("DataSet1_VivoReport", thisDataSet.Tables[0]));
thisConnection.Close();
}
}
May 9 '09 #3
Iam using the below code, everything is working fine am able to get the main report but the problem is report viewer doesn't show the subreport throws a error message: subreport could not be shown
Pls help me.

public partial class _Default : System.Web.UI.Page
{
int ordno = 134085104;
string thisConnectionString = "server=.;initial catalog=vivotech;uid=sa;pwd=sql";
SqlConnection thisConnection = new SqlConnection(thisConnectionString);
protected void Page_Load(object sender, EventArgs e)
{
ReportViewer1.Visible = true;

thisConnection.Open();
{
SqlCommand cm = new SqlCommand("Vivo_Report", thisConnection);
cm.CommandType = CommandType.StoredProcedure;
cm.Parameters.Add("OrderNumber", SqlDbType.Int).Value = ordno;
SqlDataAdapter da = new SqlDataAdapter(cm);
System.Data.DataSet thisDataSet = new System.Data.DataSet();
da.Fill(thisDataSet, "Vivo_Report");
ReportDataSource datasource = new ReportDataSource("DataSet1_Vivo_Report", thisDataSet.Tables[0]);
ReportViewer1.LocalReport.DataSources.Clear();
ReportViewer1.LocalReport.DataSources.Add(datasour ce);
this.ReportViewer1.LocalReport.SubreportProcessing += new SubreportProcessingEventHandler(SubreportProcessin gEventHandler);
ReportViewer1.LocalReport.Refresh();
}
thisConnection.Close();
}
protected void Button1_Click(object sender, EventArgs e)
{

}

public void SubreportProcessingEventHandler(object sender, SubreportProcessingEventArgs e)
{
SqlCommand cm = new SqlCommand("Vivo_Report", thisConnection);
cm.CommandType = CommandType.StoredProcedure;
cm.Parameters.Add("OrderNumber", SqlDbType.Int).Value = ordno;
SqlDataAdapter da = new SqlDataAdapter(cm);
System.Data.DataSet thisDataSet = new System.Data.DataSet();
da.Fill(thisDataSet, "Vivo_Report");
e.DataSources.Add(new ReportDataSource("DataSet1_VivoReport", thisDataSet.Tables[0]));
thisConnection.Close();
}
}
May 9 '09 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: grondaia | last post by:
Here's my situation: I have an ODBC DSN setup for Timberline Data (An accounting package that uses pervasive.sql) on my sql box. I set up a linked server using the supplied timberline odbc...
0
by: Steven | last post by:
I have a windows 2000 server running V8 fix pack 4a with the DB2 Instance. I wanted to move the active database off of the db2 instance away from the TOOLSDB so I created a new instance INST2. I...
2
by: James Neumann | last post by:
Environment: Access 2k, win2k Business Problem: I have to display returns on investments made over a period of years, and show the amount of return earned on each investment by year. For...
3
by: Xpeppe | last post by:
Hy, i read the article in msdn2 Using a Database Data Source with the ReportViewer Windows Forms Control in Local Processing Mode But i don want to use the designer assosation to the report,...
7
by: John J. Hughes II | last post by:
I have a DataGridView with a TextBoxColumn. I setting the data source to a List<stringvalue in a static class. The list is filled from a background thread. So far all is fine and it works...
1
by: GSReddy | last post by:
Hi I am trying to build bar chart in asp.net using ReportViewer data control with some sample data write here. string name = new string{"Trans", "DAS", "Lap H/w", "Lap S/w", "People"}; int val =...
0
by: NaveenDuggal | last post by:
Hi All I have designed a rdlc file, using Business Object and table control, and added it on Report Viewer control. I am facing the excepiton Exception descritption: A data source instance has...
3
by: Fresno Bob | last post by:
When you bind to the object data source you can bind to the underlying dataset that is returned by the select statement but can you bind to the properties of the object? MSDN says the...
1
by: Coderer | last post by:
I have a project that I've been working on for a while, where several forms use DataGridViews to represent database information. The forms are .NET 2.0, in Studio 2005. For the past couple of...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.