473,397 Members | 2,099 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,397 software developers and data experts.

help with subreport


I have a c# web application. I have created a crystal report and report
view
er.

I can get the report to display by itself but when I add a subreport I
eithe
r get a logon error or object not set to an instance of an object.
I found sites that show the functions to login to a subreport but it
doesn't
seem to work.

Does anyone know a simple and straight forwatrd way to logon to a
subreport
so it will display at runtime.

The subreport is basically it's own report that displays in the header
of th
e main report. It has it's own selection criteria and is NOT linked to
the m
ain report in any way.

I also would like to know why my Export script doesn't seem to work
when I
try to use a date range. It works when I have a single sql parameter
but whe
n I try to use a dat range it freaks out.

here is my code for the report by itself and the code for the export to
pdf.
if(Session["rptSelected"].ToString() == "1") //--check which report
users wa
nts to run---//
{
this.sqlSelectCommandComparison.CommandText = "SELECT * , '" +
Session["From
Date"] + "' AS FromDt, Convert(SmallDateTime, '" + Session["ToDate"] +
"') A
S ToDt FROM qselComparison WHERE SAMPDATE BETWEEN '" +
Session["FromDate"] +
"' AND '" + Session["ToDate"] + "' Order By SAMPDATE";
this.sqlDAComparison
Fill(this.dsVocComparison1,"qselComparison"); Session["ReportName"] =
"crVo
cComparison1";
this.crVocComparison1.SetDatabaseLogon("username", "password","ServerName","d
bName");
this.crVocComparison1.SetDataSource(this.dsVocComp arison1);
this.crVocComparison1.PrintOptions.PaperOrientatio n =
PaperOrientation.Portr
ait;
this.crVocComparison1.PrintOptions.PaperSize =
CrystalDecisions.Shared.Paper
Size.DefaultPaperSize;
this.crvVOC.ReportSource = this.crVocComparison1;
}
export code

if (Session["rptSelected"].ToString() =="1") //--check which report
users wa
nts to run---//
{
crVocComparison1.SetDatabaseLogon("username","pass word","ServerName","dbName
",true);
crVocComparison1.RecordSelectionFormula = crvVOC.SelectionFormula;
string selectFormula;
selectFormula = "{qselComparison.SAMPDATE} >= '" +
Session["FromDate"].To
String() + "' AND {qselComparison.SAMPDATE} <= '" +
Session["ToDate"].ToS
tring() + "'" ;
crVocComparison1.DataDefinition.RecordSelectionFor mula =
selectFormula;
MemoryStream oStream; // using System.IO
oStream =
(MemoryStream)this.crVocComparison1.ExportToStream (CrystalDecision
s.Shared.ExportFormatType.PortableDocFormat);
Response.Clear();
Response.Buffer= true;
Response.ContentType = "application/pdf";
Response.BinaryWrite(oStream.ToArray());
Response.End();
oStream.Close();
oStream = null;
}

confused confused

--
hodgesp
------------------------------------------------------------------------
Posted via http://www.codecomments.com
------------------------------------------------------------------------

Nov 28 '06 #1
0 1068

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Tiago Miguel Silva | last post by:
I there. I´m almost desperate with a report that i´m doing! I am creating a report using the push method, being the data returned by a typed dataset. The report shows activities by week and...
1
by: Manal/report designer | last post by:
Thank you in advance for any suggestions... I'm using crystal reports version 8 & SQL server. I've created a report that is composed of 2 parts: 1st part contains the mainreport which uses...
2
by: Deano | last post by:
OK, I've been taking the detour from hell trying to sort this and after taking a walk I think I need a rethink. I have a report for a single employee that includes a subreport which lists...
8
by: dixie | last post by:
I have a report with a subreport. The source object for this subreport varies according to the value of a field in a table. I am trying to programmatically set the object source for the subreport...
2
by: Sami | last post by:
Could someone explain clearly how to go about doing this? I have tried setting up the structure on numerous occasions, but it never seems to work. Could someone please help me out? Thanks!
7
by: ChadDiesel | last post by:
Hello everyone, I'm having a problem with Access that I need some help with. The short version is, I want to print a list of parts and part quantities that belong to a certain part group---One...
0
by: rjn | last post by:
Hi I have a main report in which I have inserted a sub report. I have a formula field on the main report and one on the sub report. I want the formula in the subreport to be evaluated after the...
0
by: C | last post by:
Hi, I have a main Report which has a SubReport. This SubReport also has a SubReport. I set the data of my main Report and Subreport through code DataSet dsMainReport =...
1
by: Susan-MN | last post by:
I’ve just recently started working with Access at my new job. I’ve been able to figure out quite a bit on my own, but I’m stuck with a problem I can’t seem to find answer to on the Access help or...
4
by: Wook | last post by:
Ok I got a set of Forms Reports etc it goes like this Reports Form Passes a Filter to the report for the needed results The filter it passes along is fine except one problem I need a way for the...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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
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...
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.