Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > help with subreport

Reply
Thread Tools

help with subreport

 
 
hodgesp
Guest
Posts: n/a
 
      11-27-2006

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
------------------------------------------------------------------------

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Help with subreport brian ASP .Net 0 04-01-2009 05:45 PM
Export subreport David Dvali ASP .Net 0 11-25-2005 08:32 PM
Exporting Crystal Reports subreport data David Dvali ASP .Net 0 11-25-2005 03:51 PM
printing on demand Subreport crystal =?Utf-8?B?TWJpc2hy?= ASP .Net 0 07-26-2005 05:25 PM
Crystal report with stored procedure in subreport kenneth xg ASP .Net 2 04-23-2005 03:12 PM



Advertisments