help with subreport

Discussion in 'ASP .Net' started by hodgesp, Nov 27, 2006.

  1. hodgesp

    hodgesp Guest

    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.dsVocComparison1);
    this.crVocComparison1.PrintOptions.PaperOrientation =
    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","password","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.RecordSelectionFormula =
    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
    ------------------------------------------------------------------------
     
    hodgesp, Nov 27, 2006
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. kenneth xg
    Replies:
    2
    Views:
    7,427
    crdev
    Apr 23, 2005
  2. =?Utf-8?B?TWJpc2hy?=

    printing on demand Subreport crystal

    =?Utf-8?B?TWJpc2hy?=, Jul 26, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    1,670
    =?Utf-8?B?TWJpc2hy?=
    Jul 26, 2005
  3. David Dvali

    Exporting Crystal Reports subreport data

    David Dvali, Nov 25, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    622
    David Dvali
    Nov 25, 2005
  4. David Dvali

    Export subreport

    David Dvali, Nov 25, 2005, in forum: ASP .Net
    Replies:
    0
    Views:
    2,071
    David Dvali
    Nov 25, 2005
  5. brian

    Help with subreport

    brian, Apr 1, 2009, in forum: ASP .Net
    Replies:
    0
    Views:
    473
    brian
    Apr 1, 2009
Loading...

Share This Page