473,585 Members | 2,496 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Reportviewer A data source instance has not been supplied for subreport

1 New Member
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 subreportproces sing event never firing? I have spent days trying to figure this out but most examples refer to the WinForms.Report Viewer and
none to the WebForms.Report Viewer. I have never found a complete webforms example using a subreport.
Any help would be greatly appreciated,
Kim
Jun 7 '07 #1
3 35630
adunn
1 New Member
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
sivakumarcse
6 New Member
Hi Try this , will work for you...


public partial class _Default : System.Web.UI.P age
{
int ordno = 134085104;
string thisConnectionS tring = "server=.;initi al catalog=vivotec h;uid=sa;pwd=sq l";
SqlConnection thisConnection = new SqlConnection(t hisConnectionSt ring);
protected void Page_Load(objec t sender, EventArgs e)
{
ReportViewer1.V isible = true;

thisConnection. Open();
{
SqlCommand cm = new SqlCommand("Viv o_Report", thisConnection) ;
cm.CommandType = CommandType.Sto redProcedure;
cm.Parameters.A dd("OrderNumber ", SqlDbType.Int). Value = ordno;
SqlDataAdapter da = new SqlDataAdapter( cm);
System.Data.Dat aSet thisDataSet = new System.Data.Dat aSet();
da.Fill(thisDat aSet, "Vivo_Repor t");
ReportDataSourc e datasource = new ReportDataSourc e("DataSet1_Viv o_Report", thisDataSet.Tab les[0]);
ReportViewer1.L ocalReport.Data Sources.Clear() ;
ReportViewer1.L ocalReport.Data Sources.Add(dat asource);
this.ReportView er1.LocalReport .SubreportProce ssing += new SubreportProces singEventHandle r(SubreportProc essingEventHand ler);
ReportViewer1.L ocalReport.Refr esh();
}
thisConnection. Close();
}
protected void Button1_Click(o bject sender, EventArgs e)
{

}

public void SubreportProces singEventHandle r(object sender, SubreportProces singEventArgs e)
{
SqlCommand cm = new SqlCommand("Viv o_Report", thisConnection) ;
cm.CommandType = CommandType.Sto redProcedure;
cm.Parameters.A dd("OrderNumber ", SqlDbType.Int). Value = ordno;
SqlDataAdapter da = new SqlDataAdapter( cm);
System.Data.Dat aSet thisDataSet = new System.Data.Dat aSet();
da.Fill(thisDat aSet, "Vivo_Repor t");
e.DataSources.A dd(new ReportDataSourc e("DataSet1_Viv oReport", thisDataSet.Tab les[0]));
thisConnection. Close();
}
}
May 9 '09 #3
sivakumarcse
6 New Member
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.P age
{
int ordno = 134085104;
string thisConnectionS tring = "server=.;initi al catalog=vivotec h;uid=sa;pwd=sq l";
SqlConnection thisConnection = new SqlConnection(t hisConnectionSt ring);
protected void Page_Load(objec t sender, EventArgs e)
{
ReportViewer1.V isible = true;

thisConnection. Open();
{
SqlCommand cm = new SqlCommand("Viv o_Report", thisConnection) ;
cm.CommandType = CommandType.Sto redProcedure;
cm.Parameters.A dd("OrderNumber ", SqlDbType.Int). Value = ordno;
SqlDataAdapter da = new SqlDataAdapter( cm);
System.Data.Dat aSet thisDataSet = new System.Data.Dat aSet();
da.Fill(thisDat aSet, "Vivo_Repor t");
ReportDataSourc e datasource = new ReportDataSourc e("DataSet1_Viv o_Report", thisDataSet.Tab les[0]);
ReportViewer1.L ocalReport.Data Sources.Clear() ;
ReportViewer1.L ocalReport.Data Sources.Add(dat asource);
this.ReportView er1.LocalReport .SubreportProce ssing += new SubreportProces singEventHandle r(SubreportProc essingEventHand ler);
ReportViewer1.L ocalReport.Refr esh();
}
thisConnection. Close();
}
protected void Button1_Click(o bject sender, EventArgs e)
{

}

public void SubreportProces singEventHandle r(object sender, SubreportProces singEventArgs e)
{
SqlCommand cm = new SqlCommand("Viv o_Report", thisConnection) ;
cm.CommandType = CommandType.Sto redProcedure;
cm.Parameters.A dd("OrderNumber ", SqlDbType.Int). Value = ordno;
SqlDataAdapter da = new SqlDataAdapter( cm);
System.Data.Dat aSet thisDataSet = new System.Data.Dat aSet();
da.Fill(thisDat aSet, "Vivo_Repor t");
e.DataSources.A dd(new ReportDataSourc e("DataSet1_Viv oReport", thisDataSet.Tab les[0]));
thisConnection. Close();
}
}
May 9 '09 #4

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

Similar topics

5
5657
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 driver. I have two sql instances setup, the default instance and a named instance. On the default instance, the linked server works great no matter...
0
364
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 created a database XYZ in INST2 and that went fine. I went into client configurationa and wanted to set the XYZ database "Register this database...
2
4379
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 example, if you placed some money in 2001, you'd want to see the returns on that for 2002, 2003, 2004 etc. (These are long-term investments, so it's...
3
7163
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, i want to define by code (at run time) the report and the data source to be display. example :
7
10044
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 great, at least on my system. The reason I am doing this is some customers are pulling from VPN connections which are slow. This allows the list of...
1
2110
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 = new int {10, 4, 6, 7, 3}; please suggest me how to build a graph with above sample data? I appreciate your help.
0
3666
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 not been supplied for the data source 'Ebwl_eOBR_Library_PositionException_PositionExceptionCollection'. The code wriiten in C# on .cs file , to...
3
1989
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 objectdatasource can return an object. Say for instance I have a customer object with a name property. Can I bind to it e.g. Text='<%# Bind("Name") %>'
1
2381
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 days, whenever I click the little arrow in the top-right corner to show the DataGridView Tasks subwindow, then click to expand the dropdown for...
0
7836
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8199
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8336
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7950
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
8212
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5710
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3835
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3863
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1175
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.