473,396 Members | 1,827 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,396 software developers and data experts.

Dynamic RDLC generation question

I'm a newbie to the messageboard, but I'm wondering if any of you gurus have tried to do the following before? I'm developing a custom reporting solution as part of a web application for a corporate client. One of the required features is a user-defined reporting (UDR) solution, but we cannot use ReportBuilder because their corporate firewalls prohibit ActiveX controls. Therefore, I have a wizard-style ASP.NET and C# interface that essentially allows them to go through and select the filtering parameters, fields, etc.

At the end of all that, I have generated the SQL string and I have to dynamically generate the RDLC code for this new UDR report. I have that part working and I have gone through by hand to verify that the code my rdlcGenerator is producing "appears" to be correct. (As an aside, I have opened the generated .rdlc files from within Visual Studio as well to confirm that they at least appear correct). I actually found a couple of examples on the net that helped me with the generation portion of the code. However, here's my problem:

Now that I have the new local report template that I generated, I've been unable to get it to run the actual report. I get the following error when I try to make the reportViewer display the report:
A data source instance has not been supplied for the data source 'DataSet1'.

I'll include a section of the RDLC file here to show the generic names I built into the report template:

<DataSources>
<DataSource Name="DataSource1">
<ConnectionProperties>
<DataProvider>SQL</DataProvider>
<ConnectString>Server=.;Database=fms_comm;User ID=usr;password=pwd;</ConnectString>
<IntegratedSecurity>true</IntegratedSecurity>
</ConnectionProperties>
</DataSource>
</DataSources>
<DataSets>
<DataSet Name="DataSet1">
<Query>
<DataSourceName>DataSource1</DataSourceName>
<CommandType>Text</CommandType>
<CommandText>select name as 'Name' from view_DEALER_DISPLAY</CommandText>
<Timeout>90</Timeout>
</Query>
<Fields>
<Field Name="Name">
<DataField>Name</DataField>
</Field>
</Fields>
</DataSet>
</DataSets>

And here is the c# code where I'm trying to add to add the datasource dynamically:

this.reportViewer1.ProcessingMode = ProcessingMode.Local;
this.reportViewer1.LocalReport.ReportPath = _RDLfileName;
DataTable dt;
dt = DataAccess.getDataTable(sqlText, null, false);
// the above line returns a valid dataTable that I have confirmed has records
TextReader re = File.OpenText(_RDLfileName);

ReportDataSource rds = new ReportDataSource();
rds.Name = "DataSource1_DataSet1";
rds.Value = dt;
this.reportViewer1.LocalReport.DataSources.Add(rds );
this.reportViewer1.LocalReport.LoadReportDefinitio n(re);
this.reportViewer1.LocalReport.Refresh();
re.Close();

If any of you guys can point out the error of my ways, I will GLADY acknowledge you as Guru Extraordinaire. :)
Jun 12 '07 #1
2 16708
dshipe
2
At the end of all that, I have generated the SQL string and I have to dynamically generate the RDLC code for this new UDR report."


Here is an alternate method for generating an RDLC....
http://csharpshooter.blogspot.com/2007/08/generate-rdlc-dynamically-for-vs-2005.html
Aug 7 '07 #2
dshipe
2
The easiest way to generate a simple RDLC from a dataset is transform the schema xml into the RDLC.

The basic idea is to build rather generic RLDC file off a DataSet. You can then bind both the DataSet and the RDLC to a ReportViewer control and get your report. I generate the RDLC by transforming the DataSet XML schema into a RDLC file via and XSLT transform.

Here is a website showing the C# code and the XSLT...

http://csharpshooter.blogspot.com/2007/08/revised-dynamic-rdlc-generation.html
Sep 9 '07 #3

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

Similar topics

1
by: duncan.lovett | last post by:
I am working on a graphical heading generator for a clients website as their server does not have the GD library or similar plugins for dynamic image generation. I have achieved the result...
11
by: Marco Loskamp | last post by:
Dear list, I'm trying to dynamically generate functions; it seems that what I really want is beyond C itself, but I'd like to be confirmed here. In the minimal example below, I'd like to...
4
by: DraguVaso | last post by:
Hi, For my VB.NET application I have the following situation: 2 tables on my SQL Server: tblAccounts and tblRules. For each Account there are many Rules (so tblRules is linked to my tblAccounts...
2
by: Irfan | last post by:
hi, I am getting the following error. Dynamic SQL generation is not supported against a SelectCommand that does not return any base table information when i try to use da.update I squeezed...
0
by: Gancy | last post by:
Hi, I have data access tier designed in such a way, just by changnging application settings, same lines of code is made to work with both MS SQL Server or MS Access. Code works fine with MS SQL...
15
by: Nospam | last post by:
Is there a tutorial on dynamic SID generation?
2
by: Ghada Al-Mashaqbeh via DotNetMonster.com | last post by:
Hi all, I am facing a problem in dynamic code generation at run time, the problem occurs when the dynmaic code use global data exist within the original application. Lets say that my...
5
by: =?Utf-8?B?QUEyZTcyRQ==?= | last post by:
The full error message is "Dynamic SQL generation for the UpdateCommand is not supported against a SelectCommand that does not return any key column information." I am getting this error when...
0
by: pieandpeas | last post by:
Hi, I'm having a problem with my code, I am doing the following - retrieving a field from a table, which is linked to another table, i'm only updating one of the fields in one of the two tables......
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...
0
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...
0
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.